From 7338187105782a1ed138c66fa5902939406a9db8 Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Tue, 14 Nov 2023 23:34:07 +0900 Subject: [PATCH 01/15] test: add test cases for runes --- README.md | 50 + src/parser/index.ts | 124 +- src/parser/script.ts | 36 +- src/parser/typescript/index.ts | 4 +- .../docs/fine-grained-reactivity/_config.json | 3 + .../example01-input.svelte | 24 + .../example01-no-undef-result.json | 20 + .../example01-no-unused-vars-result.json | 14 + .../example01-output.json | 4485 ++++++++++ .../example01-scope-output.json | 6766 +++++++++++++++ .../docs/functions/01-untrack-input.svelte | 12 + .../functions/01-untrack-no-undef-result.json | 14 + .../docs/functions/01-untrack-output.json | 1779 ++++ .../01-untrack-prefer-const-result.json | 14 + .../functions/01-untrack-scope-output.json | 1511 ++++ .../docs/functions/_config.json | 3 + .../docs/old-vs-new/01-counter-input.svelte | 14 + .../01-counter-no-undef-result.json | 20 + .../docs/old-vs-new/01-counter-output.json | 2336 +++++ .../01-counter-prefer-const-result.json | 8 + .../old-vs-new/01-counter-scope-output.json | 1345 +++ .../02-tracking-dependencies-input.svelte | 13 + ...tracking-dependencies-no-undef-result.json | 20 + .../02-tracking-dependencies-output.json | 3189 +++++++ ...king-dependencies-prefer-const-result.json | 8 + ...02-tracking-dependencies-scope-output.json | 1935 +++++ .../03-untracking-dependencies-input.svelte | 15 + ...tracking-dependencies-no-undef-result.json | 20 + .../03-untracking-dependencies-output.json | 3574 ++++++++ ...king-dependencies-prefer-const-result.json | 8 + ...-untracking-dependencies-scope-output.json | 2266 +++++ .../04-simple-component-props-input.svelte | 5 + ...imple-component-props-no-undef-result.json | 8 + .../04-simple-component-props-output.json | 732 ++ ...e-component-props-prefer-const-result.json | 8 + ...4-simple-component-props-scope-output.json | 561 ++ .../05-advanced-component-props-input.svelte | 7 + ...anced-component-props-no-undef-result.json | 8 + .../05-advanced-component-props-output.json | 1387 +++ ...d-component-props-prefer-const-result.json | 14 + ...advanced-component-props-scope-output.json | 922 ++ .../old-vs-new/06-autoscroll-input.svelte | 48 + .../06-autoscroll-no-undef-result.json | 38 + ...toscroll-no-unused-expressions-result.json | 8 + .../docs/old-vs-new/06-autoscroll-output.json | 7513 +++++++++++++++++ .../06-autoscroll-prefer-const-result.json | 8 + .../06-autoscroll-scope-output.json | 6239 ++++++++++++++ .../docs/old-vs-new/_config.json | 3 + .../docs/runes/01-$state-input.svelte | 7 + .../docs/runes/01-$state-no-undef-result.json | 8 + .../docs/runes/01-$state-output.json | 1224 +++ .../docs/runes/01-$state-scope-output.json | 537 ++ .../docs/runes/02-$derived-input.svelte | 10 + .../runes/02-$derived-no-undef-result.json | 14 + .../docs/runes/02-$derived-output.json | 2040 +++++ .../02-$derived-prefer-const-result.json | 8 + .../docs/runes/02-$derived-scope-output.json | 1102 +++ .../docs/runes/03-$effect-input.svelte | 24 + .../runes/03-$effect-no-undef-result.json | 20 + .../docs/runes/03-$effect-output.json | 3251 +++++++ .../runes/03-$effect-prefer-const-result.json | 8 + .../docs/runes/03-$effect-scope-output.json | 1637 ++++ .../docs/runes/04-$effect-pre-input.svelte | 28 + .../runes/04-$effect-pre-no-undef-result.json | 14 + ...fect-pre-no-unused-expressions-result.json | 8 + .../docs/runes/04-$effect-pre-output.json | 3771 +++++++++ .../04-$effect-pre-prefer-const-result.json | 8 + .../runes/04-$effect-pre-scope-output.json | 2117 +++++ .../docs/runes/05-$props-input.svelte | 3 + .../docs/runes/05-$props-no-undef-result.json | 8 + .../05-$props-no-unused-vars-result.json | 14 + .../docs/runes/05-$props-output.json | 699 ++ .../runes/05-$props-prefer-const-result.json | 14 + .../docs/runes/05-$props-scope-output.json | 889 ++ .../docs/runes/06-$props-input.svelte | 3 + .../docs/runes/06-$props-no-undef-result.json | 8 + .../06-$props-no-unused-vars-result.json | 8 + .../docs/runes/06-$props-output.json | 570 ++ .../runes/06-$props-prefer-const-result.json | 8 + .../docs/runes/06-$props-scope-output.json | 365 + .../docs/runes/07-$props-input.svelte | 3 + .../docs/runes/07-$props-no-undef-result.json | 8 + .../07-$props-no-unused-vars-result.json | 26 + .../docs/runes/07-$props-output.json | 809 ++ .../runes/07-$props-prefer-const-result.json | 26 + .../docs/runes/07-$props-scope-output.json | 1735 ++++ .../docs/runes/08-$props-ts-input.svelte | 3 + .../runes/08-$props-ts-no-undef-result.json | 14 + .../08-$props-ts-no-unused-vars-result.json | 26 + .../docs/runes/08-$props-ts-output.json | 1065 +++ .../08-$props-ts-prefer-const-result.json | 26 + .../docs/runes/08-$props-ts-scope-output.json | 2024 +++++ .../docs/runes/09-how-to-opt-in-input.svelte | 2 + .../docs/runes/09-how-to-opt-in-output.json | 390 + .../runes/09-how-to-opt-in-scope-output.json | 34 + .../svelte-5-preview/docs/runes/_config.json | 3 + .../docs/universal-reactivity/01-input.svelte | 11 + .../01-no-undef-result.json | 8 + .../docs/universal-reactivity/01-output.json | 1421 ++++ .../universal-reactivity/01-scope-output.json | 802 ++ .../docs/universal-reactivity/02-input.svelte | 20 + .../02-no-undef-result.json | 8 + .../docs/universal-reactivity/02-output.json | 2411 ++++++ .../universal-reactivity/02-scope-output.json | 1894 +++++ .../universal-reactivity/03-input.svelte.js | 14 + .../03-no-undef-result.json | 8 + .../docs/universal-reactivity/03-output.json | 1270 +++ .../universal-reactivity/03-scope-output.json | 1433 ++++ .../03-ts-input.svelte.ts | 14 + .../03-ts-no-undef-result.json | 8 + .../universal-reactivity/03-ts-output.json | 1271 +++ .../03-ts-scope-output.json | 1433 ++++ .../03-ts-type-output.svelte.ts | 14 + .../docs/universal-reactivity/_config.json | 3 + .../optin-runes01-config.json | 3 + .../optin-runes01-input.svelte | 12 + .../optin-runes01-no-undef-result.json | 14 + .../optin-runes01-output.json | 2371 ++++++ .../optin-runes01-prefer-const-result.json | 8 + .../optin-runes01-scope-output.json | 1102 +++ tests/src/parser/test-utils.ts | 37 +- tests/src/parser/typescript/index.ts | 4 +- tools/update-fixtures.ts | 48 +- 123 files changed, 87325 insertions(+), 75 deletions(-) create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json diff --git a/README.md b/README.md index 2c493c04..eb165462 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,56 @@ module.exports = { } ``` +### parserOptions.runes + +***This is an experimental feature. It may be changed or removed in minor versions without notice.*** + +If set to `true`, Rune symbols will be parsed. In this mode, the parser also parses files other than `*.svelte`. + +```json +{ + "parser": "svelte-eslint-parser", + "parserOptions": { + "runes": true + } +} +``` + +When using this mode in an ESLint configuration, it is recommended to set it per file pattern as below. + +```json +{ + "overrides": [ + { + "files": ["*.svelte"], + "parser": "svelte-eslint-parser", + "parserOptions": { + "runes": true, + "parser": "...", + ... + } + }, + { + "files": ["*.svelte.js"], + "parser": "svelte-eslint-parser", + "parserOptions": { + "runes": true, + ... + } + }, + { + "files": ["*.svelte.ts"], + "parser": "svelte-eslint-parser", + "parserOptions": { + "runes": true, + "parser": "...(ts parser)...", + ... + } + } + ] +} +``` + ## :computer: Editor Integrations ### Visual Studio Code diff --git a/src/parser/index.ts b/src/parser/index.ts index 5898b13b..1e31e661 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -10,7 +10,7 @@ import type { import type { Program } from "estree"; import type { ScopeManager } from "eslint-scope"; import { Variable } from "eslint-scope"; -import { parseScript } from "./script"; +import { parseScript, parseScriptInSvelte } from "./script"; import type * as SvAST from "./svelte-ast-types"; import { sortNodes } from "./sort"; import { parseTemplate } from "./template"; @@ -59,39 +59,48 @@ export interface ESLintExtendedProgram { // The code used to parse the script. _virtualScriptCode?: string; } -/** - * Parse source code - */ -export function parseForESLint( - code: string, - options?: any, -): { +type ParseResult = { ast: SvelteProgram; - services: Record & { - isSvelte: true; - getSvelteHtmlAst: () => SvAST.Fragment; - getStyleContext: () => StyleContext; - }; + services: Record & + ( + | { + isSvelte: true; + svelteRunes: boolean; + getSvelteHtmlAst: () => SvAST.Fragment; + getStyleContext: () => StyleContext; + } + | { isSvelte: false; svelteRunes: boolean } + ); visitorKeys: { [type: string]: string[] }; scopeManager: ScopeManager; -} { - const parserOptions = { - ecmaVersion: 2020, - sourceType: "module", - loc: true, - range: true, - raw: true, - tokens: true, - comment: true, - eslintVisitorKeys: true, - eslintScopeManager: true, - ...(options || {}), - }; - parserOptions.sourceType = "module"; - if (parserOptions.ecmaVersion <= 5 || parserOptions.ecmaVersion == null) { - parserOptions.ecmaVersion = 2015; +}; +/** + * Parse source code + */ +export function parseForESLint(code: string, options?: any): ParseResult { + const parserOptions = normalizeParserOptions(options); + + if ( + parserOptions.filePath && + !parserOptions.filePath.endsWith(".svelte") && + parserOptions.runes + ) { + const trimmed = code.trim(); + if (!trimmed.startsWith("<") && !trimmed.endsWith(">")) { + return parseAsScript(code, parserOptions); + } } + return parseAsSvelte(code, parserOptions); +} + +/** + * Parse source code as svelte component + */ +function parseAsSvelte( + code: string, + parserOptions: NormalizedParserOptions, +): ParseResult { const ctx = new Context(code, parserOptions); const resultTemplate = parseTemplate( ctx.sourceCode.template, @@ -107,7 +116,7 @@ export function parseForESLint( parserOptions, { slots: ctx.slots }, ) - : parseScript( + : parseScriptInSvelte( scripts.getCurrentVirtualCode(), scripts.attrs, parserOptions, @@ -212,6 +221,61 @@ export function parseForESLint( return resultScript as any; } +/** + * Parse source code as script + */ +function parseAsScript( + code: string, + parserOptions: NormalizedParserOptions, +): ParseResult { + const lang = parserOptions.filePath?.split(".").pop() || "js"; + // TODO support runes + const resultScript = parseScript(code, { lang }, parserOptions); + resultScript.services = Object.assign(resultScript.services || {}, { + isSvelte: false, + runes: parserOptions.runes, + }); + resultScript.visitorKeys = Object.assign({}, KEYS, resultScript.visitorKeys); + return resultScript as any; +} + +type NormalizedParserOptions = { + ecmaVersion: number | "latest"; + sourceType: "module" | "script"; + loc: boolean; + range: boolean; + raw: boolean; + tokens: boolean; + comment: boolean; + eslintVisitorKeys: boolean; + eslintScopeManager: boolean; + runes: boolean; + filePath?: string; +}; + +/** Normalize parserOptions */ +function normalizeParserOptions(options: any): NormalizedParserOptions { + const parserOptions = { + ecmaVersion: 2020, + sourceType: "module", + loc: true, + range: true, + raw: true, + tokens: true, + comment: true, + eslintVisitorKeys: true, + eslintScopeManager: true, + rune: false, + ...(options || {}), + }; + parserOptions.sourceType = "module"; + if (parserOptions.ecmaVersion <= 5 || parserOptions.ecmaVersion == null) { + parserOptions.ecmaVersion = 2015; + } + + return parserOptions; +} + /** Extract tokens */ function extractTokens(ctx: Context) { const useRanges = sortNodes([...ctx.tokens, ...ctx.comments]).map( diff --git a/src/parser/script.ts b/src/parser/script.ts index 0fedd339..17e375a7 100644 --- a/src/parser/script.ts +++ b/src/parser/script.ts @@ -5,23 +5,14 @@ import { getParser } from "./resolve-parser"; import { isEnhancedParserObject } from "./parser-object"; /** - * Parse for script + * Parse for diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json new file mode 100644 index 00000000..9012ef61 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 14 + }, + { + "ruleId": "no-undef", + "code": "$state", + "line": 12, + "column": 14 + }, + { + "ruleId": "no-undef", + "code": "$state", + "line": 13, + "column": 14 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json new file mode 100644 index 00000000..8ea9fbdb --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "remaining", + "line": 4, + "column": 11 + }, + { + "ruleId": "no-unused-vars", + "code": "addTodo", + "line": 9, + "column": 11 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json new file mode 100644 index 00000000..e4e9983f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json @@ -0,0 +1,4485 @@ +{ + "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": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [], + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "range": [ + 10, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'recalculating'", + "value": "recalculating", + "range": [ + 78, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 66, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 66, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "range": [ + 66, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UnaryExpression", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "todo", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "done", + "range": [ + 132, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "range": [ + 127, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 126, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 118, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 40 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "todos", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 111, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 105, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 105, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 41 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "length", + "range": [ + 138, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 6, + "column": 48 + } + } + }, + "range": [ + 105, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 48 + } + } + }, + "range": [ + 98, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 49 + } + } + } + ], + "range": [ + 62, + 148 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "remaining", + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "range": [ + 36, + 148 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 206, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 183, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 189, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 183, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "operator": "!==", + "right": { + "type": "Literal", + "raw": "'Enter'", + "value": "Enter", + "range": [ + 197, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + "range": [ + 183, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + "range": [ + 179, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "false", + "value": false, + "range": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 228, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 221, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + ], + "range": [ + 217, + 242 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "range": [ + 263, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 276, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 33 + }, + "end": { + "line": 13, + "column": 38 + } + } + }, + "range": [ + 263, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 38 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 256, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 39 + } + } + }, + "range": [ + 249, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 39 + } + } + } + ], + "range": [ + 245, + 283 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 40 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "todos", + "range": [ + 287, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "todos", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "range": [ + 296, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "done", + "range": [ + 315, + 319 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "done", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "range": [ + 324, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 27 + } + } + } + ], + "range": [ + 322, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 319, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "range": [ + 311, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "set", + "computed": false, + "key": { + "type": "Identifier", + "name": "done", + "range": [ + 346, + 350 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + } + ], + "range": [ + 358, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "range": [ + 350, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "range": [ + 342, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "text", + "range": [ + 383, + 387 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "text", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + "range": [ + 392, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 27 + } + } + } + ], + "range": [ + 390, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 387, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "range": [ + 379, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "set", + "computed": false, + "key": { + "type": "Identifier", + "name": "text", + "range": [ + 414, + 418 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 435, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + } + ], + "range": [ + 426, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + } + ], + "range": [ + 418, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + "range": [ + 410, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 35 + } + } + } + ], + "range": [ + 306, + 446 + ], + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ], + "range": [ + 295, + 447 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "range": [ + 287, + 447 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "range": [ + 287, + 448 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 452, + 457 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 458, + 464 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + "range": [ + 452, + 464 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 465, + 470 + ], + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "range": [ + 452, + 470 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "''", + "value": "", + "range": [ + 473, + 475 + ], + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "range": [ + 452, + 475 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "range": [ + 452, + 476 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 26 + } + } + } + ], + "range": [ + 175, + 479 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 23, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "addTodo", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + ], + "range": [ + 151, + 479 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 23, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 480, + 489 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + "range": [ + 0, + 489 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 24, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "todos", + "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": "Punctuator", + "value": "[", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 36, + 44 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "remaining", + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "String", + "value": "'recalculating'", + "range": [ + 78, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 98, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "todos", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "filter", + "range": [ + 111, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 123, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "!", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "todo", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 35 + }, + "end": { + "line": 6, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 132, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 40 + }, + "end": { + "line": 6, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 42 + } + } + }, + { + "type": "Identifier", + "value": "length", + "range": [ + 138, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 6, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 6, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 151, + 159 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "addTodo", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 179, + 181 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 183, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "key", + "range": [ + 189, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "!==", + "range": [ + 193, + 196 + ], + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "String", + "value": "'Enter'", + "range": [ + 197, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 28 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 206, + 212 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 217, + 220 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 234, + 235 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 240, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 241, + 242 + ], + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 245, + 248 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 276, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 33 + }, + "end": { + "line": 13, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 38 + }, + "end": { + "line": 13, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 13, + "column": 39 + }, + "end": { + "line": 13, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "todos", + "range": [ + 287, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 293, + 294 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 295, + 296 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 296, + 299 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "todos", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 304, + 305 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 306, + 307 + ], + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 311, + 314 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 315, + 319 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 319, + 320 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 320, + 321 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 322, + 323 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 324, + 330 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 337, + 338 + ], + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 342, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 346, + 350 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 350, + 351 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 356, + 357 + ], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 358, + 359 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 365, + 366 + ], + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 373, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 34 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 374, + 375 + ], + "loc": { + "start": { + "line": 17, + "column": 35 + }, + "end": { + "line": 17, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 379, + 382 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 383, + 387 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 387, + 388 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 388, + 389 + ], + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 390, + 391 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 392, + 398 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 404, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 28 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 18, + "column": 29 + }, + "end": { + "line": 18, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 410, + 413 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 414, + 418 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 418, + 419 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 424, + 425 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 426, + 427 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 433, + 434 + ], + "loc": { + "start": { + "line": 19, + "column": 26 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 435, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 441, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 34 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 445, + 446 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 446, + 447 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 447, + 448 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 452, + 457 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 457, + 458 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 458, + 464 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 464, + 465 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 465, + 470 + ], + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 471, + 472 + ], + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 22 + } + } + }, + { + "type": "String", + "value": "''", + "range": [ + 473, + 475 + ], + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 475, + 476 + ], + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 478, + 479 + ], + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 480, + 481 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 481, + 482 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 482, + 488 + ], + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 488, + 489 + ], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + } + ], + "range": [ + 0, + 490 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 25, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json new file mode 100644 index 00000000..47527a01 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json @@ -0,0 +1,6766 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "todos", + "identifiers": [ + { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [], + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 287, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "remaining", + "identifiers": [ + { + "type": "Identifier", + "name": "remaining", + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "remaining", + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'recalculating'", + "value": "recalculating", + "range": [ + 78, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 66, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 66, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "range": [ + 66, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UnaryExpression", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "todo", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "done", + "range": [ + 132, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "range": [ + 127, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 126, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 118, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 40 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "todos", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 111, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 105, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 105, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 41 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "length", + "range": [ + 138, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 6, + "column": 48 + } + } + }, + "range": [ + 105, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 48 + } + } + }, + "range": [ + 98, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 49 + } + } + } + ], + "range": [ + 62, + 148 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "remaining", + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "range": [ + 36, + 148 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + } + } + ], + "references": [] + }, + { + "name": "addTodo", + "identifiers": [ + { + "type": "Identifier", + "name": "addTodo", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "addTodo", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 206, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 183, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 189, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 183, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "operator": "!==", + "right": { + "type": "Literal", + "raw": "'Enter'", + "value": "Enter", + "range": [ + 197, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + "range": [ + 183, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + "range": [ + 179, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "false", + "value": false, + "range": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 228, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 221, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + ], + "range": [ + 217, + 242 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "range": [ + 263, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 276, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 33 + }, + "end": { + "line": 13, + "column": 38 + } + } + }, + "range": [ + 263, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 38 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 256, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 39 + } + } + }, + "range": [ + 249, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 39 + } + } + } + ], + "range": [ + 245, + 283 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 40 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "todos", + "range": [ + 287, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "todos", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "range": [ + 296, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "done", + "range": [ + 315, + 319 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "done", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "range": [ + 324, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 27 + } + } + } + ], + "range": [ + 322, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 319, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "range": [ + 311, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "set", + "computed": false, + "key": { + "type": "Identifier", + "name": "done", + "range": [ + 346, + 350 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + } + ], + "range": [ + 358, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "range": [ + 350, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "range": [ + 342, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "text", + "range": [ + 383, + 387 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "text", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + "range": [ + 392, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 27 + } + } + } + ], + "range": [ + 390, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 387, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "range": [ + 379, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "set", + "computed": false, + "key": { + "type": "Identifier", + "name": "text", + "range": [ + 414, + 418 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 435, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + } + ], + "range": [ + 426, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + } + ], + "range": [ + 418, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + "range": [ + 410, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 35 + } + } + } + ], + "range": [ + 306, + 446 + ], + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ], + "range": [ + 295, + 447 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "range": [ + 287, + 447 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "range": [ + 287, + 448 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 452, + 457 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 458, + 464 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + "range": [ + 452, + 464 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 465, + 470 + ], + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "range": [ + 452, + 470 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "''", + "value": "", + "range": [ + 473, + 475 + ], + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "range": [ + 452, + 475 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "range": [ + 452, + 476 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 26 + } + } + } + ], + "range": [ + 175, + 479 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 23, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "addTodo", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + ], + "range": [ + 151, + 479 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 23, + "column": 2 + } + } + } + } + ], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "todos", + "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 + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "todos", + "identifiers": [ + { + "type": "Identifier", + "name": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'recalculating'", + "value": "recalculating", + "range": [ + 78, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 74, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 66, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 66, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "range": [ + 66, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UnaryExpression", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "todo", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "done", + "range": [ + 132, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "range": [ + 127, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 126, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 118, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 40 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "todos", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 111, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 105, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 105, + 137 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 41 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "length", + "range": [ + 138, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 6, + "column": 48 + } + } + }, + "range": [ + 105, + 144 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 48 + } + } + }, + "range": [ + 98, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 49 + } + } + } + ], + "range": [ + 62, + 148 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "remaining", + "range": [ + 45, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "range": [ + 36, + 148 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "todo", + "identifiers": [ + { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UnaryExpression", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "todo", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "done", + "range": [ + 132, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "range": [ + 127, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 126, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 118, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 40 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "todo", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "todo", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "todo", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "event", + "identifiers": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 206, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 183, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 189, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 183, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "operator": "!==", + "right": { + "type": "Literal", + "raw": "'Enter'", + "value": "Enter", + "range": [ + 197, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + "range": [ + 183, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + "range": [ + 179, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "false", + "value": false, + "range": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 228, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 221, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + ], + "range": [ + 217, + 242 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "range": [ + 263, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 276, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 33 + }, + "end": { + "line": 13, + "column": 38 + } + } + }, + "range": [ + 263, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 38 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 256, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 39 + } + } + }, + "range": [ + 249, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 39 + } + } + } + ], + "range": [ + 245, + 283 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 40 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "todos", + "range": [ + 287, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "todos", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "range": [ + 296, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "done", + "range": [ + 315, + 319 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "done", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "range": [ + 324, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 27 + } + } + } + ], + "range": [ + 322, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 319, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + "range": [ + 311, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "set", + "computed": false, + "key": { + "type": "Identifier", + "name": "done", + "range": [ + 346, + 350 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + } + ], + "range": [ + 358, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "range": [ + 350, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "range": [ + 342, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "text", + "range": [ + 383, + 387 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "text", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + "range": [ + 392, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 27 + } + } + } + ], + "range": [ + 390, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 387, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + "range": [ + 379, + 405 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "set", + "computed": false, + "key": { + "type": "Identifier", + "name": "text", + "range": [ + 414, + 418 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 435, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + } + ], + "range": [ + 426, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + } + ], + "range": [ + 418, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + "range": [ + 410, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 35 + } + } + } + ], + "range": [ + 306, + 446 + ], + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ], + "range": [ + 295, + 447 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "range": [ + 287, + 447 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "range": [ + 287, + 448 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 452, + 457 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 458, + 464 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + "range": [ + 452, + 464 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 465, + 470 + ], + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "range": [ + 452, + 470 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "''", + "value": "", + "range": [ + 473, + 475 + ], + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "range": [ + 452, + 475 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "range": [ + 452, + 476 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 26 + } + } + } + ], + "range": [ + 175, + 479 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 23, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "addTodo", + "range": [ + 160, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + ], + "range": [ + 151, + 479 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 23, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 183, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 452, + 457 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + } + ] + }, + { + "name": "done", + "identifiers": [ + { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "false", + "value": false, + "range": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 228, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 221, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + } + ] + }, + { + "name": "text", + "identifiers": [ + { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 269, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "range": [ + 263, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 276, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 33 + }, + "end": { + "line": 13, + "column": 38 + } + } + }, + "range": [ + 263, + 281 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 38 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 256, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 39 + } + } + }, + "range": [ + 249, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 183, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 287, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 452, + 457 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "value", + "identifiers": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + "node": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "range": [ + 360, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 33 + } + } + } + ], + "range": [ + 358, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "range": [ + 350, + 374 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 35 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "value", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "value", + "range": [ + 367, + 372 + ], + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "value", + "range": [ + 351, + 356 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "done", + "range": [ + 360, + 364 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "done", + "range": [ + 221, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "value", + "identifiers": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "node": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 435, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "range": [ + 428, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 33 + } + } + } + ], + "range": [ + 426, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + } + ], + "range": [ + 418, + 442 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 35 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "value", + "range": [ + 435, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "value", + "range": [ + 435, + 440 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "value", + "range": [ + 419, + 424 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 428, + 432 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 249, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 287, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "todos", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "todos", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte new file mode 100644 index 00000000..640616dc --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte @@ -0,0 +1,12 @@ + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json new file mode 100644 index 00000000..8888d901 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "$props", + "line": 4, + "column": 17 + }, + { + "ruleId": "no-undef", + "code": "$effect", + "line": 6, + "column": 2 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json new file mode 100644 index 00000000..b4fd89ac --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json @@ -0,0 +1,1779 @@ +{ + "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": "ImportDeclaration", + "source": { + "type": "Literal", + "raw": "'svelte'", + "value": "svelte", + "range": [ + 34, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "local": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "range": [ + 10, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 61, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 50, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ], + "range": [ + 46, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 166, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "range": [ + 158, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 158, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + "range": [ + 158, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "Identifier", + "name": "b", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 28 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 196, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 22 + }, + "end": { + "line": 10, + "column": 29 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "untrack", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 188, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 30 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 184, + 187 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "range": [ + 176, + 187 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 176, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + "range": [ + 176, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 32 + } + } + } + ], + "range": [ + 87, + 209 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 81, + 209 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 11, + "column": 2 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$effect", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "optional": false, + "range": [ + 73, + 210 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "range": [ + 73, + 211 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 11, + "column": 4 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 212, + 221 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "range": [ + 0, + 221 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " this will run when `a` changes,", + "range": [ + 91, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 36 + } + } + }, + { + "type": "Line", + "value": " but not when `b` changes", + "range": [ + 128, + 155 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 29 + } + } + } + ], + "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": "import", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "String", + "value": "'svelte'", + "range": [ + 34, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 46, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 84, + 86 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 166, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 184, + 187 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "untrack", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 10, + "column": 22 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 10, + "column": 23 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 199, + 201 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 28 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 30 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 31 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 213, + 214 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 214, + 220 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 9 + } + } + } + ], + "range": [ + 0, + 222 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 13, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json new file mode 100644 index 00000000..d77a6435 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "prefer-const", + "code": "a", + "line": 4, + "column": 8 + }, + { + "ruleId": "prefer-const", + "code": "b", + "line": 4, + "column": 11 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json new file mode 100644 index 00000000..2ba15778 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json @@ -0,0 +1,1511 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "untrack", + "identifiers": [ + { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "node": { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "local": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "untrack", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ] + }, + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 61, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 50, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 61, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "range": [ + 50, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 28 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "untrack", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 28 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 28 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "untrack", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 28 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 176, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json new file mode 100644 index 00000000..a8a08140 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json @@ -0,0 +1,3 @@ +{ + "runes": true +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte new file mode 100644 index 00000000..95b24f75 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte @@ -0,0 +1,14 @@ + + + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json new file mode 100644 index 00000000..e02eeb79 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 3, + "column": 14 + }, + { + "ruleId": "no-undef", + "code": "$derived", + "line": 4, + "column": 15 + }, + { + "ruleId": "no-undef", + "code": "$effect", + "line": 5, + "column": 2 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json new file mode 100644 index 00000000..27c7282c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json @@ -0,0 +1,2336 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 22 + } + } + } + ], + "range": [ + 11, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 48, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + "range": [ + 39, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 33 + } + } + } + ], + "range": [ + 35, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'Too high!'", + "value": "Too high!", + "range": [ + 115, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "alert", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "optional": false, + "range": [ + 109, + 127 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 109, + 128 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 22 + } + } + } + ], + "range": [ + 104, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 92, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "operator": ">", + "right": { + "type": "Literal", + "raw": "10", + "value": 10, + "range": [ + 100, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "range": [ + 92, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "range": [ + 88, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ], + "range": [ + 84, + 135 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 78, + 135 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "optional": false, + "range": [ + 70, + 136 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "range": [ + 70, + 137 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 9, + "column": 4 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 138, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "range": [ + 0, + 147 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 147, + 149 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 150, + 156 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 160, + 165 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 157, + 165 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 173, + 180 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 31 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 167, + 180 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 31 + } + } + }, + "range": [ + 157, + 181 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 32 + } + } + } + ], + "selfClosing": false, + "range": [ + 149, + 182 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 33 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 182, + 184 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "count", + "range": [ + 185, + 190 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + "range": [ + 184, + 191 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "SvelteText", + "value": " / ", + "range": [ + 191, + 194 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "double", + "range": [ + 195, + 201 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 14, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 203, + 212 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + "range": [ + 149, + 212 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 14, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 32 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 81, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 88, + 90 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 92, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 100, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "alert", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "String", + "value": "'Too high!'", + "range": [ + 115, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 138, + 139 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 140, + 146 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 147, + 149 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 150, + 156 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 157, + 159 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 160, + 165 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 170, + 172 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 178, + 180 + ], + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 180, + 181 + ], + "loc": { + "start": { + "line": 12, + "column": 31 + }, + "end": { + "line": 12, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 33 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 182, + 184 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 185, + 190 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 191, + 192 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "/", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 193, + 194 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 195, + 201 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 205, + 211 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + } + ], + "range": [ + 0, + 213 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json new file mode 100644 index 00000000..9e7cd050 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "double", + "line": 4, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json new file mode 100644 index 00000000..b3bfc990 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json @@ -0,0 +1,1345 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 92, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 185, + 190 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ] + }, + { + "name": "double", + "identifiers": [ + { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 48, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + "range": [ + 39, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 195, + 201 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 185, + 190 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 195, + 201 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 92, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "alert", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "alert", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 92, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "alert", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 173, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "alert", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "alert", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte new file mode 100644 index 00000000..21de10ae --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte @@ -0,0 +1,13 @@ + + + + +

{a} + {b} = {sum}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json new file mode 100644 index 00000000..2ad5ad0c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 10 + }, + { + "ruleId": "no-undef", + "code": "$state", + "line": 3, + "column": 10 + }, + { + "ruleId": "no-undef", + "code": "$derived", + "line": 4, + "column": 12 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json new file mode 100644 index 00000000..d6cffa0d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json @@ -0,0 +1,3189 @@ +{ + "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": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "range": [ + 10, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 38, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 34, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "range": [ + 30, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "add", + "range": [ + 69, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "optional": false, + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 54, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "range": [ + 50, + 76 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 98, + 111 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + } + ], + "range": [ + 94, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 88, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "params": [], + "range": [ + 79, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 115, + 124 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 124 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 124, + 126 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 127, + 133 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 134, + 142 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "a", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 150, + 153 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 144, + 153 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + "range": [ + 134, + 154 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 28 + } + } + } + ], + "selfClosing": false, + "range": [ + 126, + 155 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "a++", + "range": [ + 155, + 158 + ], + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 32 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 158, + 167 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 41 + } + } + }, + "range": [ + 126, + 167 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 41 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 41 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 169, + 175 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 179, + 184 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 176, + 184 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 192, + 195 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 186, + 195 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "range": [ + 176, + 196 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 28 + } + } + } + ], + "selfClosing": false, + "range": [ + 168, + 197 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "b++", + "range": [ + 197, + 200 + ], + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 32 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 200, + 209 + ], + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 41 + } + } + }, + "range": [ + 168, + 209 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 41 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 12, + "column": 41 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 210, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 214, + 215 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + "range": [ + 213, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": " + ", + "range": [ + 216, + 219 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "b", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + "range": [ + 219, + 222 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "SvelteText", + "value": " = ", + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "sum", + "range": [ + 226, + 229 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "range": [ + 225, + 230 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 20 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 230, + 234 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 210, + 234 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 24 + } + } + } + ], + "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": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 50, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "add", + "range": [ + 69, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 79, + 87 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "add", + "range": [ + 88, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 98, + 104 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 117, + 123 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 124, + 126 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 127, + 133 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 134, + 136 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 145, + 146 + ], + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 147, + 149 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 151, + 153 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 153, + 154 + ], + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + { + "type": "HTMLText", + "value": "a++", + "range": [ + 155, + 158 + ], + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 160, + 166 + ], + "loc": { + "start": { + "line": 11, + "column": 34 + }, + "end": { + "line": 11, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 11, + "column": 40 + }, + "end": { + "line": 11, + "column": 41 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 41 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 169, + 175 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 176, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 179, + 184 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 189, + 191 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 193, + 195 + ], + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 12, + "column": 28 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + { + "type": "HTMLText", + "value": "b++", + "range": [ + 197, + 200 + ], + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 202, + 208 + ], + "loc": { + "start": { + "line": 12, + "column": 34 + }, + "end": { + "line": 12, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 12, + "column": 40 + }, + "end": { + "line": 12, + "column": 41 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 12, + "column": 41 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 213, + 214 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 214, + 215 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 216, + 217 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "+", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 218, + 219 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 219, + 220 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 221, + 222 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "=", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "sum", + "range": [ + 226, + 229 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 229, + 230 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 230, + 231 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 231, + 232 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 13, + "column": 22 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 233, + 234 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + } + ], + "range": [ + 0, + 235 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json new file mode 100644 index 00000000..cc694836 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "sum", + "line": 4, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json new file mode 100644 index 00000000..e56d77cc --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json @@ -0,0 +1,1935 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 214, + 215 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 38, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 34, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + } + ] + }, + { + "name": "sum", + "identifiers": [ + { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "add", + "range": [ + 69, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "optional": false, + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "range": [ + 54, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 226, + 229 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ] + }, + { + "name": "add", + "identifiers": [ + { + "type": "Identifier", + "name": "add", + "range": [ + 88, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "add", + "range": [ + 88, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "range": [ + 98, + 111 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + } + ], + "range": [ + 94, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 88, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "params": [], + "range": [ + 79, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 69, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "add", + "range": [ + 88, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 69, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "add", + "range": [ + 88, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 214, + 215 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 226, + 229 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 54, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte new file mode 100644 index 00000000..84f9c15b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte @@ -0,0 +1,15 @@ + + + + +

{a} + {b} = {sum}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json new file mode 100644 index 00000000..e8df7260 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 4, + "column": 10 + }, + { + "ruleId": "no-undef", + "code": "$state", + "line": 5, + "column": 10 + }, + { + "ruleId": "no-undef", + "code": "$derived", + "line": 6, + "column": 12 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json new file mode 100644 index 00000000..d4fc55f9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json @@ -0,0 +1,3574 @@ +{ + "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": "ImportDeclaration", + "source": { + "type": "Literal", + "raw": "'svelte'", + "value": "svelte", + "range": [ + 34, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "local": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "range": [ + 10, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 54, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "range": [ + 50, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 18 + } + } + } + ], + "range": [ + 46, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "range": [ + 70, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 18 + } + } + } + ], + "range": [ + 66, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "optional": false, + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 96, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 90, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + ], + "range": [ + 86, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 153, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 28 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "untrack", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 145, + 161 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "range": [ + 141, + 161 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "range": [ + 134, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 30 + } + } + } + ], + "range": [ + 130, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 124, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + "params": [], + "range": [ + 115, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 166, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "range": [ + 0, + 175 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 175, + 177 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 178, + 184 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 188, + 193 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 185, + 193 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "a", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 201, + 204 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 195, + 204 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + "range": [ + 185, + 205 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 28 + } + } + } + ], + "selfClosing": false, + "range": [ + 177, + 206 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 29 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "a++", + "range": [ + 206, + 209 + ], + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 32 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 209, + 218 + ], + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 41 + } + } + }, + "range": [ + 177, + 218 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 41 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 218, + 219 + ], + "loc": { + "start": { + "line": 13, + "column": 41 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 220, + 226 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 230, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 227, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 243, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 237, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + "range": [ + 227, + 247 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 28 + } + } + } + ], + "selfClosing": false, + "range": [ + 219, + 248 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "b++", + "range": [ + 248, + 251 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 32 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 251, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 41 + } + } + }, + "range": [ + 219, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 41 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 41 + }, + "end": { + "line": 15, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 261, + 264 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "range": [ + 264, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": " + ", + "range": [ + 267, + 270 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "b", + "range": [ + 271, + 272 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "range": [ + 270, + 273 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + { + "type": "SvelteText", + "value": " = ", + "range": [ + 273, + 276 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "sum", + "range": [ + 277, + 280 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "range": [ + 276, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 20 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 281, + 285 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + "range": [ + 261, + 285 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 24 + } + } + } + ], + "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": "import", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "String", + "value": "'svelte'", + "range": [ + 34, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 46, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 86, + 89 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 115, + 123 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "add", + "range": [ + 124, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 134, + 140 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "untrack", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 153, + 154 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 156, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 168, + 174 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 175, + 177 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 178, + 184 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 185, + 187 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 188, + 193 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 193, + 194 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 198, + 200 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 202, + 204 + ], + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 13, + "column": 27 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 13, + "column": 28 + }, + "end": { + "line": 13, + "column": 29 + } + } + }, + { + "type": "HTMLText", + "value": "a++", + "range": [ + 206, + 209 + ], + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 13, + "column": 33 + }, + "end": { + "line": 13, + "column": 34 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 211, + 217 + ], + "loc": { + "start": { + "line": 13, + "column": 34 + }, + "end": { + "line": 13, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 13, + "column": 40 + }, + "end": { + "line": 13, + "column": 41 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 218, + 219 + ], + "loc": { + "start": { + "line": 13, + "column": 41 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 219, + 220 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 220, + 226 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 227, + 229 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 229, + 230 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 230, + 235 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 235, + 236 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 237, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 240, + 242 + ], + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 244, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": "HTMLText", + "value": "b++", + "range": [ + 248, + 251 + ], + "loc": { + "start": { + "line": 14, + "column": 29 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 14, + "column": 33 + }, + "end": { + "line": 14, + "column": 34 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 253, + 259 + ], + "loc": { + "start": { + "line": 14, + "column": 34 + }, + "end": { + "line": 14, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 40 + }, + "end": { + "line": 14, + "column": 41 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 41 + }, + "end": { + "line": 15, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 262, + 263 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 263, + 264 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 264, + 265 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "+", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 269, + 270 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 270, + 271 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 271, + 272 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 272, + 273 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 273, + 274 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "=", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "sum", + "range": [ + 277, + 280 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + } + } + ], + "range": [ + 0, + 286 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 16, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json new file mode 100644 index 00000000..49e55e1e --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "sum", + "line": 6, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json new file mode 100644 index 00000000..d298cd8c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json @@ -0,0 +1,2266 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "untrack", + "identifiers": [ + { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "node": { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "local": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "untrack", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ] + }, + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 54, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "range": [ + 50, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "range": [ + 70, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 271, + 272 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + } + ] + }, + { + "name": "sum", + "identifiers": [ + { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "optional": false, + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 96, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 90, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 277, + 280 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + } + ] + }, + { + "name": "add", + "identifiers": [ + { + "type": "Identifier", + "name": "add", + "range": [ + 124, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "add", + "range": [ + 124, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + "operator": "+", + "right": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 153, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 28 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "untrack", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 145, + 161 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "range": [ + 141, + 161 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "range": [ + 134, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 30 + } + } + } + ], + "range": [ + 130, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "add", + "range": [ + 124, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + "params": [], + "range": [ + 115, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "add", + "range": [ + 124, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "add", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "add", + "range": [ + 124, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 271, + 272 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "sum", + "range": [ + 277, + 280 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "sum", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "untrack", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "untrack", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "untrack", + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte new file mode 100644 index 00000000..d7db5237 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte @@ -0,0 +1,5 @@ + + +{count} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json new file mode 100644 index 00000000..6f4beb4c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$props", + "line": 2, + "column": 22 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json new file mode 100644 index 00000000..23d91020 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json @@ -0,0 +1,732 @@ +{ + "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": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "optional": false, + "range": [ + 30, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "range": [ + 14, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 29 + } + } + } + ], + "range": [ + 10, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 40, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 7 + } + } + } + ], + "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": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + } + ], + "range": [ + 0, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json new file mode 100644 index 00000000..3e0fd283 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "count", + "line": 2, + "column": 8 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json new file mode 100644 index 00000000..bbcd0151 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json @@ -0,0 +1,561 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "optional": false, + "range": [ + 30, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "range": [ + 14, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 29 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte new file mode 100644 index 00000000..56273b84 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte @@ -0,0 +1,7 @@ + + +
+	{JSON.stringify(others)}
+
diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json new file mode 100644 index 00000000..628f52b7 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$props", + "line": 2, + "column": 40 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json new file mode 100644 index 00000000..ca05f181 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json @@ -0,0 +1,1387 @@ +{ + "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": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "class", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 16, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "range": [ + 34, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + ], + "range": [ + 14, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "optional": false, + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "range": [ + 14, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 47 + } + } + } + ], + "range": [ + 10, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 48 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 58, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 67, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "pre", + "range": [ + 70, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "class", + "range": [ + 74, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "classname", + "range": [ + 81, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 80, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "range": [ + 74, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "selfClosing": false, + "range": [ + 69, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 92, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "others", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 23 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "JSON", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "stringify", + "range": [ + 100, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "range": [ + 95, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "optional": false, + "range": [ + 95, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "range": [ + 94, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 7, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "range": [ + 69, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + } + ], + "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": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "class", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 67, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "pre", + "range": [ + 70, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "class", + "range": [ + 74, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "classname", + "range": [ + 81, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 92, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "JSON", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "stringify", + "range": [ + 100, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "others", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "pre", + "range": [ + 121, + 124 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + } + ], + "range": [ + 0, + 126 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json new file mode 100644 index 00000000..1413498b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "prefer-const", + "code": "classname", + "line": 2, + "column": 15 + }, + { + "ruleId": "prefer-const", + "code": "others", + "line": 2, + "column": 29 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json new file mode 100644 index 00000000..6ef2b559 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json @@ -0,0 +1,922 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "classname", + "identifiers": [ + { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "class", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 16, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "range": [ + 34, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + ], + "range": [ + 14, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "optional": false, + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "range": [ + 14, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 47 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "classname", + "range": [ + 81, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ] + }, + { + "name": "others", + "identifiers": [ + { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "class", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 16, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "range": [ + 34, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + ], + "range": [ + 14, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "optional": false, + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "range": [ + 14, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 47 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "others", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "classname", + "range": [ + 81, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "classname", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "JSON", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "others", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "others", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "JSON", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "JSON", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte new file mode 100644 index 00000000..b80c0f47 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte @@ -0,0 +1,48 @@ + + +
+
+ {#each messages as message} +

{message}

+ {/each} +
+ + + + +
diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json new file mode 100644 index 00000000..6ae46930 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json @@ -0,0 +1,38 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 4, + "column": 14 + }, + { + "ruleId": "no-undef", + "code": "$state", + "line": 5, + "column": 17 + }, + { + "ruleId": "no-undef", + "code": "$effect", + "line": 9, + "column": 2 + }, + { + "ruleId": "no-undef", + "code": "toggleValue", + "line": 32, + "column": 3 + }, + { + "ruleId": "no-undef", + "code": "toggleValue", + "line": 32, + "column": 18 + }, + { + "ruleId": "no-undef", + "code": "viewport", + "line": 37, + "column": 18 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json new file mode 100644 index 00000000..06b0d10f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-expressions", + "code": "messages;", + "line": 10, + "column": 3 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json new file mode 100644 index 00000000..af1e13d5 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json @@ -0,0 +1,7513 @@ +{ + "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": "ImportDeclaration", + "source": { + "type": "Literal", + "raw": "'svelte'", + "value": "svelte", + "range": [ + 31, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "local": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "range": [ + 10, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'dark'", + "value": "dark", + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 55, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "range": [ + 47, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 27 + } + } + } + ], + "range": [ + 43, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [], + "range": [ + 94, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 87, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 76, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "range": [ + 72, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "init": null, + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + ], + "range": [ + 101, + 109 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "messages", + "range": [ + 134, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "range": [ + 134, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "init": { + "type": "LogicalExpression", + "left": { + "type": "Identifier", + "name": "div", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "left": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "offsetHeight", + "range": [ + 176, + 188 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 44 + } + } + }, + "range": [ + 172, + 188 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 44 + } + } + }, + "operator": "+", + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 191, + 194 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollTop", + "range": [ + 195, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 51 + }, + "end": { + "line": 11, + "column": 60 + } + } + }, + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 60 + } + } + }, + "range": [ + 172, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 60 + } + } + }, + "operator": ">", + "right": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollHeight", + "range": [ + 211, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 67 + }, + "end": { + "line": 11, + "column": 79 + } + } + }, + "range": [ + 207, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 79 + } + } + }, + "operator": "-", + "right": { + "type": "Literal", + "raw": "50", + "value": 50, + "range": [ + 226, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 82 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 207, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 172, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 165, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 152, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 84 + } + } + } + ], + "range": [ + 146, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 85 + } + } + }, + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 294, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollHeight", + "range": [ + 298, + 310 + ], + "loc": { + "start": { + "line": 15, + "column": 24 + }, + "end": { + "line": 15, + "column": 36 + } + } + }, + "range": [ + 294, + 310 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollTo", + "range": [ + 282, + 290 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "range": [ + 278, + 290 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "optional": false, + "range": [ + 278, + 311 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 37 + } + } + }, + "range": [ + 278, + 312 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 38 + } + } + } + ], + "range": [ + 272, + 317 + ], + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 266, + 317 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 16, + "column": 4 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "tick", + "range": [ + 254, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "optional": false, + "range": [ + 254, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "then", + "range": [ + 261, + 265 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + "range": [ + 254, + 265 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 254, + 318 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 16, + "column": 5 + } + } + }, + "range": [ + 254, + 319 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 16, + "column": 6 + } + } + } + ], + "range": [ + 249, + 323 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + "test": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 237, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + "range": [ + 233, + 323 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ], + "range": [ + 130, + 327 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 124, + 327 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 19, + "column": 2 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "pre", + "range": [ + 120, + 123 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 112, + 123 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "optional": false, + "range": [ + 112, + 328 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + "range": [ + 112, + 329 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 417, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "range": [ + 411, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 424, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 411, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 404, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 34 + } + } + } + ], + "range": [ + 398, + 430 + ], + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 35 + } + } + }, + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 445, + 452 + ], + "loc": { + "start": { + "line": 24, + "column": 14 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + "test": { + "type": "UnaryExpression", + "argument": { + "type": "Identifier", + "name": "text", + "range": [ + 439, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 438, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "range": [ + 434, + 452 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "range": [ + 469, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + { + "type": "Identifier", + "name": "text", + "range": [ + 482, + 486 + ], + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 32 + } + } + } + ], + "range": [ + 468, + 487 + ], + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + "range": [ + 457, + 487 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + "range": [ + 457, + 488 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 34 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 492, + 497 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 498, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + "range": [ + 492, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 505, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + "range": [ + 492, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "''", + "value": "", + "range": [ + 513, + 515 + ], + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + "range": [ + 492, + 515 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + "range": [ + 492, + 516 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 27 + } + } + } + ], + "range": [ + 393, + 520 + ], + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 28, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 370, + 375 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 376, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "range": [ + 370, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "'Enter'", + "value": "Enter", + "range": [ + 384, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + "range": [ + 370, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + "range": [ + 366, + 520 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + } + } + ], + "range": [ + 362, + 523 + ], + "loc": { + "start": { + "line": 21, + "column": 31 + }, + "end": { + "line": 29, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + ], + "range": [ + 332, + 523 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 548, + 559 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "operator": "=", + "right": { + "type": "UnaryExpression", + "argument": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 563, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 562, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 16 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "range": [ + 548, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "range": [ + 548, + 575 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 29 + } + } + } + ], + "range": [ + 544, + 578 + ], + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 33, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "toggle", + "range": [ + 535, + 541 + ], + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 16 + } + } + }, + "params": [], + "range": [ + 526, + 578 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 33, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 579, + 588 + ], + "loc": { + "start": { + "line": 34, + "column": 0 + }, + "end": { + "line": 34, + "column": 9 + } + } + }, + "range": [ + 0, + 588 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 34, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 588, + 590 + ], + "loc": { + "start": { + "line": 34, + "column": 9 + }, + "end": { + "line": 36, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "div", + "range": [ + 591, + 594 + ], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Class", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "dark", + "range": [ + 601, + 605 + ], + "loc": { + "start": { + "line": 36, + "column": 11 + }, + "end": { + "line": 36, + "column": 15 + } + } + }, + "modifiers": [], + "range": [ + 595, + 605 + ], + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 15 + } + } + }, + "expression": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "theme", + "range": [ + 607, + 612 + ], + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 22 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "'dark'", + "value": "dark", + "range": [ + 617, + 623 + ], + "loc": { + "start": { + "line": 36, + "column": 27 + }, + "end": { + "line": 36, + "column": 33 + } + } + }, + "range": [ + 607, + 623 + ], + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 33 + } + } + }, + "shorthand": false, + "range": [ + 595, + 624 + ], + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 34 + } + } + } + ], + "selfClosing": false, + "range": [ + 590, + 625 + ], + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 35 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 625, + 627 + ], + "loc": { + "start": { + "line": 36, + "column": 35 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "div", + "range": [ + 628, + 631 + ], + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Binding", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "this", + "range": [ + 637, + 641 + ], + "loc": { + "start": { + "line": 37, + "column": 11 + }, + "end": { + "line": 37, + "column": 15 + } + } + }, + "modifiers": [], + "range": [ + 632, + 641 + ], + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 15 + } + } + }, + "expression": { + "type": "Identifier", + "name": "viewport", + "range": [ + 643, + 651 + ], + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + } + }, + "shorthand": false, + "range": [ + 632, + 652 + ], + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 26 + } + } + } + ], + "selfClosing": false, + "range": [ + 627, + 653 + ], + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 27 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 653, + 656 + ], + "loc": { + "start": { + "line": 37, + "column": 27 + }, + "end": { + "line": 38, + "column": 2 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "messages", + "range": [ + 663, + 671 + ], + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 17 + } + } + }, + "context": { + "type": "Identifier", + "name": "message", + "range": [ + 675, + 682 + ], + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 28 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 688, + 689 + ], + "loc": { + "start": { + "line": 39, + "column": 4 + }, + "end": { + "line": 39, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 687, + 690 + ], + "loc": { + "start": { + "line": 39, + "column": 3 + }, + "end": { + "line": 39, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 691, + 698 + ], + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 14 + } + } + }, + "range": [ + 690, + 699 + ], + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 15 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 699, + 703 + ], + "loc": { + "start": { + "line": 39, + "column": 15 + }, + "end": { + "line": 39, + "column": 19 + } + } + }, + "range": [ + 687, + 703 + ], + "loc": { + "start": { + "line": 39, + "column": 3 + }, + "end": { + "line": 39, + "column": 19 + } + } + } + ], + "else": null, + "range": [ + 656, + 713 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 40, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 713, + 715 + ], + "loc": { + "start": { + "line": 40, + "column": 9 + }, + "end": { + "line": 41, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 715, + 721 + ], + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 7 + } + } + }, + "range": [ + 627, + 721 + ], + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 41, + "column": 7 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t", + "range": [ + 721, + 724 + ], + "loc": { + "start": { + "line": 41, + "column": 7 + }, + "end": { + "line": 43, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "input", + "range": [ + 725, + 730 + ], + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "keydown", + "range": [ + 734, + 741 + ], + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 18 + } + } + }, + "modifiers": [], + "range": [ + 731, + 741 + ], + "loc": { + "start": { + "line": 43, + "column": 8 + }, + "end": { + "line": 43, + "column": 18 + } + } + }, + "expression": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 743, + 756 + ], + "loc": { + "start": { + "line": 43, + "column": 20 + }, + "end": { + "line": 43, + "column": 33 + } + } + }, + "range": [ + 731, + 757 + ], + "loc": { + "start": { + "line": 43, + "column": 8 + }, + "end": { + "line": 43, + "column": 34 + } + } + } + ], + "selfClosing": true, + "range": [ + 724, + 760 + ], + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 37 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 724, + 760 + ], + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 37 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t", + "range": [ + 760, + 763 + ], + "loc": { + "start": { + "line": 43, + "column": 37 + }, + "end": { + "line": 45, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 764, + 770 + ], + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 774, + 779 + ], + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 17 + } + } + }, + "modifiers": [], + "range": [ + 771, + 779 + ], + "loc": { + "start": { + "line": 45, + "column": 9 + }, + "end": { + "line": 45, + "column": 17 + } + } + }, + "expression": { + "type": "Identifier", + "name": "toggle", + "range": [ + 781, + 787 + ], + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 25 + } + } + }, + "range": [ + 771, + 788 + ], + "loc": { + "start": { + "line": 45, + "column": 9 + }, + "end": { + "line": 45, + "column": 26 + } + } + } + ], + "selfClosing": false, + "range": [ + 763, + 789 + ], + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 27 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\tToggle dark mode\n\t", + "range": [ + 789, + 810 + ], + "loc": { + "start": { + "line": 45, + "column": 27 + }, + "end": { + "line": 47, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 810, + 819 + ], + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 10 + } + } + }, + "range": [ + 763, + 819 + ], + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 47, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 819, + 820 + ], + "loc": { + "start": { + "line": 47, + "column": 10 + }, + "end": { + "line": 48, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 820, + 826 + ], + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 6 + } + } + }, + "range": [ + 590, + 826 + ], + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 48, + "column": 6 + } + } + } + ], + "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": "import", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "String", + "value": "'svelte'", + "range": [ + 31, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "String", + "value": "'dark'", + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 72, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 101, + 104 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "pre", + "range": [ + 120, + 123 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 127, + 129 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "messages", + "range": [ + 134, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 146, + 151 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "&&", + "range": [ + 169, + 171 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "offsetHeight", + "range": [ + 176, + 188 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 11, + "column": 45 + }, + "end": { + "line": 11, + "column": 46 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 191, + 194 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 11, + "column": 50 + }, + "end": { + "line": 11, + "column": 51 + } + } + }, + { + "type": "Identifier", + "value": "scrollTop", + "range": [ + 195, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 51 + }, + "end": { + "line": 11, + "column": 60 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 61 + }, + "end": { + "line": 11, + "column": 62 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 66 + }, + "end": { + "line": 11, + "column": 67 + } + } + }, + { + "type": "Identifier", + "value": "scrollHeight", + "range": [ + 211, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 67 + }, + "end": { + "line": 11, + "column": 79 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 11, + "column": 80 + }, + "end": { + "line": 11, + "column": 81 + } + } + }, + { + "type": "Numeric", + "value": "50", + "range": [ + 226, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 82 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 84 + }, + "end": { + "line": 11, + "column": 85 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 233, + 235 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "autoscroll", + "range": [ + 237, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 249, + 250 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "tick", + "range": [ + 254, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "then", + "range": [ + 261, + 265 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 269, + 271 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 272, + 273 + ], + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "scrollTo", + "range": [ + 282, + 290 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 290, + 291 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 294, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "scrollHeight", + "range": [ + 298, + 310 + ], + "loc": { + "start": { + "line": 15, + "column": 24 + }, + "end": { + "line": 15, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 310, + 311 + ], + "loc": { + "start": { + "line": 15, + "column": 36 + }, + "end": { + "line": 15, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 15, + "column": 37 + }, + "end": { + "line": 15, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 316, + 317 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 317, + 318 + ], + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 318, + 319 + ], + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 322, + 323 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 326, + 327 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 327, + 328 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 328, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 332, + 340 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 354, + 355 + ], + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 360, + 361 + ], + "loc": { + "start": { + "line": 21, + "column": 29 + }, + "end": { + "line": 21, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 362, + 363 + ], + "loc": { + "start": { + "line": 21, + "column": 31 + }, + "end": { + "line": 21, + "column": 32 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 366, + 368 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 22, + "column": 5 + }, + "end": { + "line": 22, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 370, + 375 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 375, + 376 + ], + "loc": { + "start": { + "line": 22, + "column": 11 + }, + "end": { + "line": 22, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "key", + "range": [ + 376, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "===", + "range": [ + 380, + 383 + ], + "loc": { + "start": { + "line": 22, + "column": 16 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + { + "type": "String", + "value": "'Enter'", + "range": [ + 384, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 391, + 392 + ], + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 393, + 394 + ], + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 30 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 398, + 403 + ], + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 409, + 410 + ], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 416, + 417 + ], + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 417, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 423, + 424 + ], + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 424, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 429, + 430 + ], + "loc": { + "start": { + "line": 23, + "column": 34 + }, + "end": { + "line": 23, + "column": 35 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 434, + 436 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 437, + 438 + ], + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "!", + "range": [ + 438, + 439 + ], + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 439, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 443, + 444 + ], + "loc": { + "start": { + "line": 24, + "column": 12 + }, + "end": { + "line": 24, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 445, + 451 + ], + "loc": { + "start": { + "line": 24, + "column": 14 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 451, + 452 + ], + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 466, + 467 + ], + "loc": { + "start": { + "line": 26, + "column": 12 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 468, + 469 + ], + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 469, + 472 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 480, + 481 + ], + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "text", + "range": [ + 482, + 486 + ], + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 486, + 487 + ], + "loc": { + "start": { + "line": 26, + "column": 32 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 487, + 488 + ], + "loc": { + "start": { + "line": 26, + "column": 33 + }, + "end": { + "line": 26, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "event", + "range": [ + 492, + 497 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 497, + 498 + ], + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "target", + "range": [ + 498, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 27, + "column": 15 + }, + "end": { + "line": 27, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "value", + "range": [ + 505, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 511, + 512 + ], + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 23 + } + } + }, + { + "type": "String", + "value": "''", + "range": [ + 513, + 515 + ], + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 515, + 516 + ], + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 519, + 520 + ], + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 522, + 523 + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 526, + 534 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "toggle", + "range": [ + 535, + 541 + ], + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 541, + 542 + ], + "loc": { + "start": { + "line": 31, + "column": 16 + }, + "end": { + "line": 31, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 542, + 543 + ], + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 544, + 545 + ], + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "toggleValue", + "range": [ + 548, + 559 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 560, + 561 + ], + "loc": { + "start": { + "line": 32, + "column": 14 + }, + "end": { + "line": 32, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "!", + "range": [ + 562, + 563 + ], + "loc": { + "start": { + "line": 32, + "column": 16 + }, + "end": { + "line": 32, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "toggleValue", + "range": [ + 563, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 574, + 575 + ], + "loc": { + "start": { + "line": 32, + "column": 28 + }, + "end": { + "line": 32, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 577, + 578 + ], + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 579, + 580 + ], + "loc": { + "start": { + "line": 34, + "column": 0 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 580, + 581 + ], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 581, + 587 + ], + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 34, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 587, + 588 + ], + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 588, + 590 + ], + "loc": { + "start": { + "line": 34, + "column": 9 + }, + "end": { + "line": 36, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 590, + 591 + ], + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 591, + 594 + ], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "class", + "range": [ + 595, + 600 + ], + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 600, + 601 + ], + "loc": { + "start": { + "line": 36, + "column": 10 + }, + "end": { + "line": 36, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "dark", + "range": [ + 601, + 605 + ], + "loc": { + "start": { + "line": 36, + "column": 11 + }, + "end": { + "line": 36, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 605, + 606 + ], + "loc": { + "start": { + "line": 36, + "column": 15 + }, + "end": { + "line": 36, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 606, + 607 + ], + "loc": { + "start": { + "line": 36, + "column": 16 + }, + "end": { + "line": 36, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "theme", + "range": [ + 607, + 612 + ], + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "===", + "range": [ + 613, + 616 + ], + "loc": { + "start": { + "line": 36, + "column": 23 + }, + "end": { + "line": 36, + "column": 26 + } + } + }, + { + "type": "String", + "value": "'dark'", + "range": [ + 617, + 623 + ], + "loc": { + "start": { + "line": 36, + "column": 27 + }, + "end": { + "line": 36, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 623, + 624 + ], + "loc": { + "start": { + "line": 36, + "column": 33 + }, + "end": { + "line": 36, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 624, + 625 + ], + "loc": { + "start": { + "line": 36, + "column": 34 + }, + "end": { + "line": 36, + "column": 35 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 625, + 627 + ], + "loc": { + "start": { + "line": 36, + "column": 35 + }, + "end": { + "line": 37, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 627, + 628 + ], + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 628, + 631 + ], + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 5 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "bind", + "range": [ + 632, + 636 + ], + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 636, + 637 + ], + "loc": { + "start": { + "line": 37, + "column": 10 + }, + "end": { + "line": 37, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "this", + "range": [ + 637, + 641 + ], + "loc": { + "start": { + "line": 37, + "column": 11 + }, + "end": { + "line": 37, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 641, + 642 + ], + "loc": { + "start": { + "line": 37, + "column": 15 + }, + "end": { + "line": 37, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 642, + 643 + ], + "loc": { + "start": { + "line": 37, + "column": 16 + }, + "end": { + "line": 37, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "viewport", + "range": [ + 643, + 651 + ], + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 651, + 652 + ], + "loc": { + "start": { + "line": 37, + "column": 25 + }, + "end": { + "line": 37, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 652, + 653 + ], + "loc": { + "start": { + "line": 37, + "column": 26 + }, + "end": { + "line": 37, + "column": 27 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 653, + 656 + ], + "loc": { + "start": { + "line": 37, + "column": 27 + }, + "end": { + "line": 38, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 656, + 657 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 657, + 662 + ], + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "messages", + "range": [ + 663, + 671 + ], + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 672, + 674 + ], + "loc": { + "start": { + "line": 38, + "column": 18 + }, + "end": { + "line": 38, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 675, + 682 + ], + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 682, + 683 + ], + "loc": { + "start": { + "line": 38, + "column": 28 + }, + "end": { + "line": 38, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 687, + 688 + ], + "loc": { + "start": { + "line": 39, + "column": 3 + }, + "end": { + "line": 39, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 688, + 689 + ], + "loc": { + "start": { + "line": 39, + "column": 4 + }, + "end": { + "line": 39, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 689, + 690 + ], + "loc": { + "start": { + "line": 39, + "column": 5 + }, + "end": { + "line": 39, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 690, + 691 + ], + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 691, + 698 + ], + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 698, + 699 + ], + "loc": { + "start": { + "line": 39, + "column": 14 + }, + "end": { + "line": 39, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 699, + 700 + ], + "loc": { + "start": { + "line": 39, + "column": 15 + }, + "end": { + "line": 39, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 700, + 701 + ], + "loc": { + "start": { + "line": 39, + "column": 16 + }, + "end": { + "line": 39, + "column": 17 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 701, + 702 + ], + "loc": { + "start": { + "line": 39, + "column": 17 + }, + "end": { + "line": 39, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 702, + 703 + ], + "loc": { + "start": { + "line": 39, + "column": 18 + }, + "end": { + "line": 39, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 706, + 707 + ], + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 707, + 712 + ], + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 712, + 713 + ], + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 713, + 715 + ], + "loc": { + "start": { + "line": 40, + "column": 9 + }, + "end": { + "line": 41, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 715, + 716 + ], + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 716, + 717 + ], + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 717, + 720 + ], + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 720, + 721 + ], + "loc": { + "start": { + "line": 41, + "column": 6 + }, + "end": { + "line": 41, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t", + "range": [ + 721, + 724 + ], + "loc": { + "start": { + "line": 41, + "column": 7 + }, + "end": { + "line": 43, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 724, + 725 + ], + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "input", + "range": [ + 725, + 730 + ], + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 731, + 733 + ], + "loc": { + "start": { + "line": 43, + "column": 8 + }, + "end": { + "line": 43, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 733, + 734 + ], + "loc": { + "start": { + "line": 43, + "column": 10 + }, + "end": { + "line": 43, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "keydown", + "range": [ + 734, + 741 + ], + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 741, + 742 + ], + "loc": { + "start": { + "line": 43, + "column": 18 + }, + "end": { + "line": 43, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 742, + 743 + ], + "loc": { + "start": { + "line": 43, + "column": 19 + }, + "end": { + "line": 43, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "handleKeydown", + "range": [ + 743, + 756 + ], + "loc": { + "start": { + "line": 43, + "column": 20 + }, + "end": { + "line": 43, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 756, + 757 + ], + "loc": { + "start": { + "line": 43, + "column": 33 + }, + "end": { + "line": 43, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 758, + 759 + ], + "loc": { + "start": { + "line": 43, + "column": 35 + }, + "end": { + "line": 43, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 759, + 760 + ], + "loc": { + "start": { + "line": 43, + "column": 36 + }, + "end": { + "line": 43, + "column": 37 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t", + "range": [ + 760, + 763 + ], + "loc": { + "start": { + "line": 43, + "column": 37 + }, + "end": { + "line": 45, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 763, + 764 + ], + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 764, + 770 + ], + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 8 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 771, + 773 + ], + "loc": { + "start": { + "line": 45, + "column": 9 + }, + "end": { + "line": 45, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 773, + 774 + ], + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 774, + 779 + ], + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 779, + 780 + ], + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 780, + 781 + ], + "loc": { + "start": { + "line": 45, + "column": 18 + }, + "end": { + "line": 45, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "toggle", + "range": [ + 781, + 787 + ], + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 787, + 788 + ], + "loc": { + "start": { + "line": 45, + "column": 25 + }, + "end": { + "line": 45, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 788, + 789 + ], + "loc": { + "start": { + "line": 45, + "column": 26 + }, + "end": { + "line": 45, + "column": 27 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 789, + 792 + ], + "loc": { + "start": { + "line": 45, + "column": 27 + }, + "end": { + "line": 46, + "column": 2 + } + } + }, + { + "type": "HTMLText", + "value": "Toggle", + "range": [ + 792, + 798 + ], + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 798, + 799 + ], + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "dark", + "range": [ + 799, + 803 + ], + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 803, + 804 + ], + "loc": { + "start": { + "line": 46, + "column": 13 + }, + "end": { + "line": 46, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "mode", + "range": [ + 804, + 808 + ], + "loc": { + "start": { + "line": 46, + "column": 14 + }, + "end": { + "line": 46, + "column": 18 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 808, + 810 + ], + "loc": { + "start": { + "line": 46, + "column": 18 + }, + "end": { + "line": 47, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 810, + 811 + ], + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 811, + 812 + ], + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 812, + 818 + ], + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 818, + 819 + ], + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 819, + 820 + ], + "loc": { + "start": { + "line": 47, + "column": 10 + }, + "end": { + "line": 48, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 820, + 821 + ], + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 821, + 822 + ], + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 822, + 825 + ], + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 825, + 826 + ], + "loc": { + "start": { + "line": 48, + "column": 5 + }, + "end": { + "line": 48, + "column": 6 + } + } + } + ], + "range": [ + 0, + 827 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 49, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json new file mode 100644 index 00000000..65a55407 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "theme", + "line": 4, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json new file mode 100644 index 00000000..64b003a4 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json @@ -0,0 +1,6239 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "tick", + "identifiers": [ + { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "node": { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "local": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 254, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ] + }, + { + "name": "theme", + "identifiers": [ + { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'dark'", + "value": "dark", + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 26 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 55, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "range": [ + 47, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 27 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "theme", + "range": [ + 607, + 612 + ], + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + } + ] + }, + { + "name": "messages", + "identifiers": [ + { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrayExpression", + "elements": [], + "range": [ + 94, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 87, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 76, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 134, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + "from": "block", + "init": false, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 663, + 671 + ], + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + } + ] + }, + { + "name": "div", + "identifiers": [ + { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "init": null, + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 191, + 194 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 294, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + } + ] + }, + { + "name": "handleKeydown", + "identifiers": [ + { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 417, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "range": [ + 411, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 424, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 411, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 404, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 34 + } + } + } + ], + "range": [ + 398, + 430 + ], + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 35 + } + } + }, + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 445, + 452 + ], + "loc": { + "start": { + "line": 24, + "column": 14 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + "test": { + "type": "UnaryExpression", + "argument": { + "type": "Identifier", + "name": "text", + "range": [ + 439, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 438, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "range": [ + 434, + 452 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "range": [ + 469, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + { + "type": "Identifier", + "name": "text", + "range": [ + 482, + 486 + ], + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 32 + } + } + } + ], + "range": [ + 468, + 487 + ], + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + "range": [ + 457, + 487 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + "range": [ + 457, + 488 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 34 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 492, + 497 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 498, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + "range": [ + 492, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 505, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + "range": [ + 492, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "''", + "value": "", + "range": [ + 513, + 515 + ], + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + "range": [ + 492, + 515 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + "range": [ + 492, + 516 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 27 + } + } + } + ], + "range": [ + 393, + 520 + ], + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 28, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 370, + 375 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 376, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "range": [ + 370, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "'Enter'", + "value": "Enter", + "range": [ + 384, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + "range": [ + 370, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + "range": [ + 366, + 520 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + } + } + ], + "range": [ + 362, + 523 + ], + "loc": { + "start": { + "line": 21, + "column": 31 + }, + "end": { + "line": 29, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + ], + "range": [ + 332, + 523 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 743, + 756 + ], + "loc": { + "start": { + "line": 43, + "column": 20 + }, + "end": { + "line": 43, + "column": 33 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + } + } + ] + }, + { + "name": "toggle", + "identifiers": [ + { + "type": "Identifier", + "name": "toggle", + "range": [ + 535, + 541 + ], + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 16 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "toggle", + "range": [ + 535, + 541 + ], + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 16 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 548, + 559 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "operator": "=", + "right": { + "type": "UnaryExpression", + "argument": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 563, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 562, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 16 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "range": [ + 548, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "range": [ + 548, + 575 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 29 + } + } + } + ], + "range": [ + 544, + 578 + ], + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 33, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "toggle", + "range": [ + 535, + 541 + ], + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 16 + } + } + }, + "params": [], + "range": [ + 526, + 578 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 33, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "toggle", + "range": [ + 781, + 787 + ], + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "toggle", + "range": [ + 535, + 541 + ], + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 16 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "theme", + "range": [ + 607, + 612 + ], + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "theme", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "viewport", + "range": [ + 643, + 651 + ], + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 663, + 671 + ], + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 743, + 756 + ], + "loc": { + "start": { + "line": 43, + "column": 20 + }, + "end": { + "line": 43, + "column": 33 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "toggle", + "range": [ + 781, + 787 + ], + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "toggle", + "range": [ + 535, + 541 + ], + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 16 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "autoscroll", + "identifiers": [ + { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "init": { + "type": "LogicalExpression", + "left": { + "type": "Identifier", + "name": "div", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "left": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "offsetHeight", + "range": [ + 176, + 188 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 44 + } + } + }, + "range": [ + 172, + 188 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 44 + } + } + }, + "operator": "+", + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 191, + 194 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollTop", + "range": [ + 195, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 51 + }, + "end": { + "line": 11, + "column": 60 + } + } + }, + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 60 + } + } + }, + "range": [ + 172, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 60 + } + } + }, + "operator": ">", + "right": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollHeight", + "range": [ + 211, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 67 + }, + "end": { + "line": 11, + "column": 79 + } + } + }, + "range": [ + 207, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 79 + } + } + }, + "operator": "-", + "right": { + "type": "Literal", + "raw": "50", + "value": 50, + "range": [ + 226, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 82 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 207, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 172, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 165, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 84 + } + } + }, + "range": [ + 152, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 84 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 237, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 134, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 191, + 194 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 237, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "autoscroll", + "range": [ + 152, + 162 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 254, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 294, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 294, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 254, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 294, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 134, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 191, + 194 + ], + "loc": { + "start": { + "line": 11, + "column": 47 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 207, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 254, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 294, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 105, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "event", + "identifiers": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 417, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "range": [ + 411, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 424, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 411, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 404, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 34 + } + } + } + ], + "range": [ + 398, + 430 + ], + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 35 + } + } + }, + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 445, + 452 + ], + "loc": { + "start": { + "line": 24, + "column": 14 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + "test": { + "type": "UnaryExpression", + "argument": { + "type": "Identifier", + "name": "text", + "range": [ + 439, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 438, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "range": [ + 434, + 452 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + "operator": "=", + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "range": [ + 469, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + { + "type": "Identifier", + "name": "text", + "range": [ + 482, + 486 + ], + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 32 + } + } + } + ], + "range": [ + 468, + 487 + ], + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + "range": [ + 457, + 487 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + "range": [ + 457, + 488 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 34 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 492, + 497 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 498, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + "range": [ + 492, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 505, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + "range": [ + 492, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "''", + "value": "", + "range": [ + 513, + 515 + ], + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + "range": [ + 492, + 515 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + "range": [ + 492, + 516 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 27 + } + } + } + ], + "range": [ + 393, + 520 + ], + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 28, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 370, + 375 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 376, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "range": [ + 370, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "'Enter'", + "value": "Enter", + "range": [ + 384, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + "range": [ + 370, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + "range": [ + 366, + 520 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + } + } + ], + "range": [ + 362, + 523 + ], + "loc": { + "start": { + "line": 21, + "column": 31 + }, + "end": { + "line": 29, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "handleKeydown", + "range": [ + 341, + 354 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + ], + "range": [ + 332, + 523 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 370, + 375 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 492, + 497 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 370, + 375 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [ + { + "name": "text", + "identifiers": [ + { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "target", + "range": [ + 417, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "range": [ + 411, + 423 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 424, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 411, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 34 + } + } + }, + "range": [ + 404, + 429 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 34 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + "from": "block", + "init": true, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 439, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 482, + 486 + ], + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 32 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + }, + "from": "block", + "init": true, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 439, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 12 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + "from": "block", + "init": false, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "text", + "range": [ + 482, + 486 + ], + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 32 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "text", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 492, + 497 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 411, + 416 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + "from": "block", + "init": false, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "event", + "range": [ + 492, + 497 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "event", + "range": [ + 355, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 29 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 11 + } + } + }, + "from": "block", + "init": false, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 472, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 548, + 559 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 563, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 548, + 559 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 563, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "message", + "identifiers": [ + { + "type": "Identifier", + "name": "message", + "range": [ + 675, + 682 + ], + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 28 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "message", + "range": [ + 675, + 682 + ], + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 28 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "messages", + "range": [ + 663, + 671 + ], + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 17 + } + } + }, + "context": { + "type": "Identifier", + "name": "message", + "range": [ + 675, + 682 + ], + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 28 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 688, + 689 + ], + "loc": { + "start": { + "line": 39, + "column": 4 + }, + "end": { + "line": 39, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 687, + 690 + ], + "loc": { + "start": { + "line": 39, + "column": 3 + }, + "end": { + "line": 39, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 691, + 698 + ], + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 14 + } + } + }, + "range": [ + 690, + 699 + ], + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 15 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 699, + 703 + ], + "loc": { + "start": { + "line": 39, + "column": 15 + }, + "end": { + "line": 39, + "column": 19 + } + } + }, + "range": [ + 687, + 703 + ], + "loc": { + "start": { + "line": 39, + "column": 3 + }, + "end": { + "line": 39, + "column": 19 + } + } + } + ], + "else": null, + "range": [ + 656, + 713 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 40, + "column": 9 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 691, + 698 + ], + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 675, + 682 + ], + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 28 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 691, + 698 + ], + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 675, + 682 + ], + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 28 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 548, + 559 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 563, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "viewport", + "range": [ + 643, + 651 + ], + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 548, + 559 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "from": "function", + "init": false, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "toggleValue", + "range": [ + 563, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "viewport", + "range": [ + 643, + 651 + ], + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json new file mode 100644 index 00000000..a8a08140 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json @@ -0,0 +1,3 @@ +{ + "runes": true +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte new file mode 100644 index 00000000..0b5ebf4a --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte @@ -0,0 +1,7 @@ + + + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json new file mode 100644 index 00000000..060e6fe9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 14 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json new file mode 100644 index 00000000..cfba0680 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json @@ -0,0 +1,1224 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 45, + 51 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 52, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 68, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 62, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + "range": [ + 52, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 32 + } + } + } + ], + "selfClosing": false, + "range": [ + 44, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\tclicks: ", + "range": [ + 77, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "range": [ + 87, + 94 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 7, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 95, + 104 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "range": [ + 44, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 45, + 51 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 52, + 54 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 65, + 67 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 68, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 73, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 77, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "clicks:", + "range": [ + 79, + 86 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 97, + 103 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + } + ], + "range": [ + 0, + 105 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json new file mode 100644 index 00000000..55f86dd8 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json @@ -0,0 +1,537 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 68, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 68, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 68, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "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 + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte new file mode 100644 index 00000000..7935359b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte @@ -0,0 +1,10 @@ + + + + +

{count} doubled is {double}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json new file mode 100644 index 00000000..52df4003 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 14 + }, + { + "ruleId": "no-undef", + "code": "$derived", + "line": 3, + "column": 15 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json new file mode 100644 index 00000000..b34140e1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json @@ -0,0 +1,2040 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + "range": [ + 56, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 47, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "range": [ + 38, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + ], + "range": [ + 34, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 34 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 68, + 77 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "range": [ + 0, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 77, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 80, + 86 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 90, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 87, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 103, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 31 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 97, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 31 + } + } + }, + "range": [ + 87, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 32 + } + } + } + ], + "selfClosing": false, + "range": [ + 79, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 33 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 112, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "double", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "range": [ + 114, + 122 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 123, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "range": [ + 79, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 132, + 134 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 134, + 137 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "count", + "range": [ + 138, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "range": [ + 137, + 144 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": " doubled is ", + "range": [ + 144, + 156 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "double", + "range": [ + 157, + 163 + ], + "loc": { + "start": { + "line": 10, + "column": 23 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "range": [ + 156, + 164 + ], + "loc": { + "start": { + "line": 10, + "column": 22 + }, + "end": { + "line": 10, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 164, + 168 + ], + "loc": { + "start": { + "line": 10, + "column": 30 + }, + "end": { + "line": 10, + "column": 34 + } + } + }, + "range": [ + 134, + 168 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 34 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 70, + 76 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 77, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 6, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 80, + 86 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 87, + 89 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 90, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 100, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 108, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 29 + }, + "end": { + "line": 6, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 32 + }, + "end": { + "line": 6, + "column": 33 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 112, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 125, + 131 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 132, + 134 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 138, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "doubled", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "is", + "range": [ + 153, + 155 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 10, + "column": 22 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 157, + 163 + ], + "loc": { + "start": { + "line": 10, + "column": 23 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 10, + "column": 30 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 10, + "column": 31 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 32 + }, + "end": { + "line": 10, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 10, + "column": 33 + }, + "end": { + "line": 10, + "column": 34 + } + } + } + ], + "range": [ + 0, + 169 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json new file mode 100644 index 00000000..ce8533a2 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "double", + "line": 3, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json new file mode 100644 index 00000000..f298c5aa --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json @@ -0,0 +1,1102 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 138, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "double", + "identifiers": [ + { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + "range": [ + 56, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 47, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "range": [ + 38, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 157, + 163 + ], + "loc": { + "start": { + "line": 10, + "column": 23 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 138, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 157, + 163 + ], + "loc": { + "start": { + "line": 10, + "column": 23 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte new file mode 100644 index 00000000..5a2b2931 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte @@ -0,0 +1,24 @@ + + + + +

{count} doubled is {double}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json new file mode 100644 index 00000000..0567ec77 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 14 + }, + { + "ruleId": "no-undef", + "code": "$derived", + "line": 3, + "column": 15 + }, + { + "ruleId": "no-undef", + "code": "$effect", + "line": 5, + "column": 2 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json new file mode 100644 index 00000000..73770948 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json @@ -0,0 +1,3251 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + "range": [ + 56, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 47, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "range": [ + 38, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + ], + "range": [ + 34, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "count", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "double", + "range": [ + 238, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "double", + "range": [ + 238, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "range": [ + 238, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 29 + } + } + } + ], + "range": [ + 229, + 246 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 31 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 225, + 228 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "range": [ + 217, + 228 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 217, + 247 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + "range": [ + 217, + 248 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'cleanup'", + "value": "cleanup", + "range": [ + 415, + 424 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 24 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 411, + 414 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "range": [ + 403, + 414 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 403, + 425 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + "range": [ + 403, + 426 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 26 + } + } + } + ], + "range": [ + 265, + 430 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 259, + 430 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + "range": [ + 252, + 431 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 16, + "column": 4 + } + } + } + ], + "range": [ + 84, + 434 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 78, + 434 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 17, + "column": 2 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "optional": false, + "range": [ + 70, + 435 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + "range": [ + 70, + 436 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 17, + "column": 4 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 437, + 446 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "range": [ + 0, + 446 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 446, + 448 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 20, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 449, + 455 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 459, + 464 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 456, + 464 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 472, + 477 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 29 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 472, + 479 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 31 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 466, + 479 + ], + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + } + }, + "range": [ + 456, + 480 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 32 + } + } + } + ], + "selfClosing": false, + "range": [ + 448, + 481 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 33 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 481, + 483 + ], + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "double", + "range": [ + 484, + 490 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "range": [ + 483, + 491 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 491, + 492 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 492, + 501 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + "range": [ + 448, + 501 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 501, + 503 + ], + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 24, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 503, + 506 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "count", + "range": [ + 507, + 512 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + "range": [ + 506, + 513 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": " doubled is ", + "range": [ + 513, + 525 + ], + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 22 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "double", + "range": [ + 526, + 532 + ], + "loc": { + "start": { + "line": 24, + "column": 23 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + "range": [ + 525, + 533 + ], + "loc": { + "start": { + "line": 24, + "column": 22 + }, + "end": { + "line": 24, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 533, + 537 + ], + "loc": { + "start": { + "line": 24, + "column": 30 + }, + "end": { + "line": 24, + "column": 34 + } + } + }, + "range": [ + 503, + 537 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 34 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " runs when the component is mounted, and again", + "range": [ + 88, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 50 + } + } + }, + { + "type": "Line", + "value": " whenever `count` or `double` change,", + "range": [ + 139, + 178 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 41 + } + } + }, + { + "type": "Line", + "value": " after the DOM has been updated", + "range": [ + 181, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 35 + } + } + }, + { + "type": "Line", + "value": " if a callback is provided, it will run", + "range": [ + 270, + 311 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 44 + } + } + }, + { + "type": "Line", + "value": " a) immediately before the effect re-runs", + "range": [ + 315, + 358 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 46 + } + } + }, + { + "type": "Line", + "value": " b) when the component is destroyed", + "range": [ + 362, + 399 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 40 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 81, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 225, + 228 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 229, + 230 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 238, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 9, + "column": 31 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 252, + 258 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 262, + 264 + ], + "loc": { + "start": { + "line": 11, + "column": 12 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 410, + 411 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 411, + 414 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 414, + 415 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": "String", + "value": "'cleanup'", + "range": [ + 415, + 424 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 424, + 425 + ], + "loc": { + "start": { + "line": 15, + "column": 24 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 425, + 426 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 429, + 430 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 430, + 431 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 433, + 434 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 434, + 435 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 435, + 436 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 437, + 438 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 438, + 439 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 439, + 445 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 445, + 446 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 446, + 448 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 20, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 448, + 449 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 449, + 455 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 456, + 458 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 458, + 459 + ], + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 459, + 464 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 464, + 465 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 465, + 466 + ], + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 466, + 467 + ], + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 467, + 468 + ], + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 469, + 471 + ], + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 472, + 477 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 477, + 479 + ], + "loc": { + "start": { + "line": 20, + "column": 29 + }, + "end": { + "line": 20, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 479, + 480 + ], + "loc": { + "start": { + "line": 20, + "column": 31 + }, + "end": { + "line": 20, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 480, + 481 + ], + "loc": { + "start": { + "line": 20, + "column": 32 + }, + "end": { + "line": 20, + "column": 33 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 481, + 483 + ], + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 483, + 484 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 484, + 490 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 490, + 491 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 491, + 492 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 22, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 492, + 493 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 493, + 494 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 494, + 500 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 500, + 501 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 501, + 503 + ], + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 24, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 503, + 504 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 505, + 506 + ], + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 506, + 507 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 507, + 512 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 512, + 513 + ], + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 513, + 514 + ], + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "doubled", + "range": [ + 514, + 521 + ], + "loc": { + "start": { + "line": 24, + "column": 11 + }, + "end": { + "line": 24, + "column": 18 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 521, + 522 + ], + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "is", + "range": [ + 522, + 524 + ], + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 524, + 525 + ], + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 525, + 526 + ], + "loc": { + "start": { + "line": 24, + "column": 22 + }, + "end": { + "line": 24, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 526, + 532 + ], + "loc": { + "start": { + "line": 24, + "column": 23 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 532, + 533 + ], + "loc": { + "start": { + "line": 24, + "column": 29 + }, + "end": { + "line": 24, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 533, + 534 + ], + "loc": { + "start": { + "line": 24, + "column": 30 + }, + "end": { + "line": 24, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 534, + 535 + ], + "loc": { + "start": { + "line": 24, + "column": 31 + }, + "end": { + "line": 24, + "column": 32 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 535, + 536 + ], + "loc": { + "start": { + "line": 24, + "column": 32 + }, + "end": { + "line": 24, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 536, + 537 + ], + "loc": { + "start": { + "line": 24, + "column": 33 + }, + "end": { + "line": 24, + "column": 34 + } + } + } + ], + "range": [ + 0, + 538 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 25, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json new file mode 100644 index 00000000..ce8533a2 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "double", + "line": 3, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json new file mode 100644 index 00000000..5476e492 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json @@ -0,0 +1,1637 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 472, + 477 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 507, + 512 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "double", + "identifiers": [ + { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + "range": [ + 56, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 47, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "range": [ + 38, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 238, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 484, + 490 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 526, + 532 + ], + "loc": { + "start": { + "line": 24, + "column": 23 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 484, + 490 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 507, + 512 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 526, + 532 + ], + "loc": { + "start": { + "line": 24, + "column": 23 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 238, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 238, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 472, + 477 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 472, + 477 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte new file mode 100644 index 00000000..e3a9afbe --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte @@ -0,0 +1,28 @@ + + +
+ {#each message as message} +

{message}

+ {/each} +
diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json new file mode 100644 index 00000000..50127dc7 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "$effect", + "line": 9, + "column": 2 + }, + { + "ruleId": "no-undef", + "code": "message", + "line": 25, + "column": 9 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json new file mode 100644 index 00000000..ff6ad292 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-expressions", + "code": "messages;", + "line": 13, + "column": 3 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json new file mode 100644 index 00000000..185ba70a --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json @@ -0,0 +1,3771 @@ +{ + "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": "ImportDeclaration", + "source": { + "type": "Literal", + "raw": "'svelte'", + "value": "svelte", + "range": [ + 31, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "local": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "range": [ + 10, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "init": null, + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + ], + "range": [ + 43, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "init": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 68, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "range": [ + 57, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 18 + } + } + } + ], + "range": [ + 53, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 115, + 122 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "test": { + "type": "UnaryExpression", + "argument": { + "type": "Identifier", + "name": "div", + "range": [ + 110, + 113 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "operator": "!", + "prefix": true, + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "range": [ + 105, + 122 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "messages", + "range": [ + 217, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "range": [ + 217, + 226 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 381, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollHeight", + "range": [ + 385, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 24 + }, + "end": { + "line": 18, + "column": 36 + } + } + }, + "range": [ + 381, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 365, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollTo", + "range": [ + 369, + 377 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "range": [ + 365, + 377 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "optional": false, + "range": [ + 365, + 398 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "range": [ + 365, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 38 + } + } + } + ], + "range": [ + 359, + 404 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 353, + 404 + ], + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 19, + "column": 4 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "tick", + "range": [ + 341, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "optional": false, + "range": [ + 341, + 347 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "then", + "range": [ + 348, + 352 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + "range": [ + 341, + 352 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 341, + 405 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + "range": [ + 341, + 406 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 19, + "column": 6 + } + } + } + ], + "range": [ + 336, + 410 + ], + "loc": { + "start": { + "line": 16, + "column": 64 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "offsetHeight", + "range": [ + 282, + 294 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + "range": [ + 278, + 294 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + "operator": "+", + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 297, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollTop", + "range": [ + 301, + 310 + ], + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 38 + } + } + }, + "range": [ + 297, + 310 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 38 + } + } + }, + "range": [ + 278, + 310 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 38 + } + } + }, + "operator": ">", + "right": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "div", + "range": [ + 313, + 316 + ], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 44 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "scrollHeight", + "range": [ + 317, + 329 + ], + "loc": { + "start": { + "line": 16, + "column": 45 + }, + "end": { + "line": 16, + "column": 57 + } + } + }, + "range": [ + 313, + 329 + ], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 57 + } + } + }, + "operator": "-", + "right": { + "type": "Literal", + "raw": "20", + "value": 20, + "range": [ + 332, + 334 + ], + "loc": { + "start": { + "line": 16, + "column": 60 + }, + "end": { + "line": 16, + "column": 62 + } + } + }, + "range": [ + 313, + 334 + ], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 62 + } + } + }, + "range": [ + 278, + 334 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 62 + } + } + }, + "range": [ + 274, + 410 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ], + "range": [ + 101, + 413 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 95, + 413 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 21, + "column": 2 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 83, + 90 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "pre", + "range": [ + 91, + 94 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 83, + 94 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "optional": false, + "range": [ + 83, + 414 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + "range": [ + 83, + 415 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 21, + "column": 4 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 416, + 425 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + "range": [ + 0, + 425 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 425, + 427 + ], + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 24, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "div", + "range": [ + 428, + 431 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Binding", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "this", + "range": [ + 437, + 441 + ], + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 14 + } + } + }, + "modifiers": [], + "range": [ + 432, + 441 + ], + "loc": { + "start": { + "line": 24, + "column": 5 + }, + "end": { + "line": 24, + "column": 14 + } + } + }, + "expression": { + "type": "Identifier", + "name": "div", + "range": [ + 443, + 446 + ], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + "shorthand": false, + "range": [ + 432, + 447 + ], + "loc": { + "start": { + "line": 24, + "column": 5 + }, + "end": { + "line": 24, + "column": 20 + } + } + } + ], + "selfClosing": false, + "range": [ + 427, + 448 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 448, + 450 + ], + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 25, + "column": 1 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 457, + 464 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + "context": { + "type": "Identifier", + "name": "message", + "range": [ + 468, + 475 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 480, + 481 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 479, + 482 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 483, + 490 + ], + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + "range": [ + 482, + 491 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 491, + 495 + ], + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + "range": [ + 479, + 495 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 18 + } + } + } + ], + "else": null, + "range": [ + 450, + 504 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 28, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 505, + 511 + ], + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + } + }, + "range": [ + 427, + 511 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " ...", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Line", + "value": " not yet mounted", + "range": [ + 123, + 141 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 38 + } + } + }, + { + "type": "Line", + "value": " reference `messages` so that this code re-runs whenever it changes", + "range": [ + 145, + 214 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 71 + } + } + }, + { + "type": "Line", + "value": " autoscroll when new messages are added", + "range": [ + 230, + 271 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 43 + } + } + } + ], + "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": "import", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "String", + "value": "'svelte'", + "range": [ + 31, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 53, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 83, + 90 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "pre", + "range": [ + 91, + 94 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 98, + 100 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 105, + 107 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "!", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 110, + 113 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "messages", + "range": [ + 217, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 274, + 276 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "offsetHeight", + "range": [ + 282, + 294 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 295, + 296 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 297, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 300, + 301 + ], + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "scrollTop", + "range": [ + 301, + 310 + ], + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 311, + 312 + ], + "loc": { + "start": { + "line": 16, + "column": 39 + }, + "end": { + "line": 16, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 313, + 316 + ], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 316, + 317 + ], + "loc": { + "start": { + "line": 16, + "column": 44 + }, + "end": { + "line": 16, + "column": 45 + } + } + }, + { + "type": "Identifier", + "value": "scrollHeight", + "range": [ + 317, + 329 + ], + "loc": { + "start": { + "line": 16, + "column": 45 + }, + "end": { + "line": 16, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 330, + 331 + ], + "loc": { + "start": { + "line": 16, + "column": 58 + }, + "end": { + "line": 16, + "column": 59 + } + } + }, + { + "type": "Numeric", + "value": "20", + "range": [ + 332, + 334 + ], + "loc": { + "start": { + "line": 16, + "column": 60 + }, + "end": { + "line": 16, + "column": 62 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 334, + 335 + ], + "loc": { + "start": { + "line": 16, + "column": 62 + }, + "end": { + "line": 16, + "column": 63 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 16, + "column": 64 + }, + "end": { + "line": 16, + "column": 65 + } + } + }, + { + "type": "Identifier", + "value": "tick", + "range": [ + 341, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 346, + 347 + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "then", + "range": [ + 348, + 352 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 352, + 353 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 354, + 355 + ], + "loc": { + "start": { + "line": 17, + "column": 16 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 356, + 358 + ], + "loc": { + "start": { + "line": 17, + "column": 18 + }, + "end": { + "line": 17, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 359, + 360 + ], + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 365, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 368, + 369 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "scrollTo", + "range": [ + 369, + 377 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 377, + 378 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 379, + 380 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 381, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 384, + 385 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "scrollHeight", + "range": [ + 385, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 24 + }, + "end": { + "line": 18, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 397, + 398 + ], + "loc": { + "start": { + "line": 18, + "column": 36 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 398, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 37 + }, + "end": { + "line": 18, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 403, + 404 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 404, + 405 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 409, + 410 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 412, + 413 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 414, + 415 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 416, + 417 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 417, + 418 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 418, + 424 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 424, + 425 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 425, + 427 + ], + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 24, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 427, + 428 + ], + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 428, + 431 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "bind", + "range": [ + 432, + 436 + ], + "loc": { + "start": { + "line": 24, + "column": 5 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 436, + 437 + ], + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "this", + "range": [ + 437, + 441 + ], + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 441, + 442 + ], + "loc": { + "start": { + "line": 24, + "column": 14 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 442, + 443 + ], + "loc": { + "start": { + "line": 24, + "column": 15 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "div", + "range": [ + 443, + 446 + ], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 446, + 447 + ], + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 447, + 448 + ], + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 448, + 450 + ], + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 25, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 450, + 451 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 451, + 456 + ], + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 457, + 464 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 465, + 467 + ], + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 468, + 475 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 475, + 476 + ], + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 479, + 480 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 480, + 481 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 481, + 482 + ], + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 482, + 483 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 483, + 490 + ], + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 490, + 491 + ], + "loc": { + "start": { + "line": 26, + "column": 13 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 491, + 492 + ], + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 492, + 493 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 493, + 494 + ], + "loc": { + "start": { + "line": 26, + "column": 16 + }, + "end": { + "line": 26, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 494, + 495 + ], + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 497, + 498 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 498, + 503 + ], + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 503, + 504 + ], + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 28, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 505, + 506 + ], + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 506, + 507 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 507, + 510 + ], + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 510, + 511 + ], + "loc": { + "start": { + "line": 28, + "column": 5 + }, + "end": { + "line": 28, + "column": 6 + } + } + } + ], + "range": [ + 0, + 512 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 29, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json new file mode 100644 index 00000000..f1aa55a2 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "messages", + "line": 5, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json new file mode 100644 index 00000000..598cb574 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json @@ -0,0 +1,2117 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "tick", + "identifiers": [ + { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "node": { + "type": "ImportSpecifier", + "imported": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "local": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 341, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ] + }, + { + "name": "div", + "identifiers": [ + { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "init": null, + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 110, + 113 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 297, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 313, + 316 + ], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 44 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 365, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 381, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 443, + 446 + ], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ] + }, + { + "name": "messages", + "identifiers": [ + { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "init": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 68, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "range": [ + 57, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 18 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 217, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 83, + 90 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 443, + 446 + ], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 457, + 464 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 110, + 113 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 217, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 297, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 313, + 316 + ], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 44 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 341, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 365, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 381, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 365, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 381, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 341, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 365, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 381, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 110, + 113 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 217, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 278, + 281 + ], + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 297, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 313, + 316 + ], + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 44 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "tick", + "range": [ + 341, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "tick", + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 365, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "div", + "range": [ + 381, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "div", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "message", + "identifiers": [ + { + "type": "Identifier", + "name": "message", + "range": [ + 468, + 475 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "message", + "range": [ + 468, + 475 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 457, + 464 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + "context": { + "type": "Identifier", + "name": "message", + "range": [ + 468, + 475 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 480, + 481 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 479, + 482 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 483, + 490 + ], + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + "range": [ + 482, + 491 + ], + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 491, + 495 + ], + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + "range": [ + 479, + 495 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 18 + } + } + } + ], + "else": null, + "range": [ + 450, + 504 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 27, + "column": 8 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 483, + 490 + ], + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 468, + 475 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 26 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 483, + 490 + ], + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 468, + 475 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 26 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 83, + 90 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 457, + 464 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 83, + 90 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 457, + 464 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte new file mode 100644 index 00000000..9f8ddff5 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte @@ -0,0 +1,3 @@ + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json new file mode 100644 index 00000000..63db00b8 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$props", + "line": 2, + "column": 47 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json new file mode 100644 index 00000000..2f801b22 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "optionalProp", + "line": 2, + "column": 11 + }, + { + "ruleId": "no-unused-vars", + "code": "requiredProp", + "line": 2, + "column": 30 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json new file mode 100644 index 00000000..767af0de --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json @@ -0,0 +1,699 @@ +{ + "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": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "right": { + "type": "Literal", + "raw": "42", + "value": 42, + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "range": [ + 17, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "optional": false, + "range": [ + 55, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + "range": [ + 17, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 54 + } + } + } + ], + "range": [ + 13, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 65, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 74 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 54 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "range": [ + 0, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json new file mode 100644 index 00000000..0f3914ff --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "prefer-const", + "code": "optionalProp", + "line": 2, + "column": 11 + }, + { + "ruleId": "prefer-const", + "code": "requiredProp", + "line": 2, + "column": 30 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json new file mode 100644 index 00000000..eb02f053 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json @@ -0,0 +1,889 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "optionalProp", + "identifiers": [ + { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "right": { + "type": "Literal", + "raw": "42", + "value": 42, + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "range": [ + 17, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "optional": false, + "range": [ + 55, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + "range": [ + 17, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 54 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ] + }, + { + "name": "requiredProp", + "identifiers": [ + { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "right": { + "type": "Literal", + "raw": "42", + "value": 42, + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "range": [ + 17, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "optional": false, + "range": [ + 55, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + "range": [ + 17, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 54 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "optionalProp", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "requiredProp", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte new file mode 100644 index 00000000..c3d4c6a4 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte @@ -0,0 +1,3 @@ + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json new file mode 100644 index 00000000..d13cc8c1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$props", + "line": 2, + "column": 31 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json new file mode 100644 index 00000000..a42744a8 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "theCatch", + "line": 2, + "column": 18 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json new file mode 100644 index 00000000..11f6e0a4 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json @@ -0,0 +1,570 @@ +{ + "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": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "catch", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "range": [ + 17, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "optional": false, + "range": [ + 39, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "range": [ + 17, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + ], + "range": [ + 13, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 49, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "catch", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "range": [ + 0, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json new file mode 100644 index 00000000..7874e547 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "theCatch", + "line": 2, + "column": 18 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json new file mode 100644 index 00000000..26644c36 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json @@ -0,0 +1,365 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "theCatch", + "identifiers": [ + { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "catch", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "range": [ + 17, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "optional": false, + "range": [ + 39, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "range": [ + 17, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "theCatch", + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte new file mode 100644 index 00000000..1c4db2a1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte @@ -0,0 +1,3 @@ + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json new file mode 100644 index 00000000..0fd845f6 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$props", + "line": 2, + "column": 42 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json new file mode 100644 index 00000000..ae6a736e --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json @@ -0,0 +1,26 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "a", + "line": 2, + "column": 11 + }, + { + "ruleId": "no-unused-vars", + "code": "b", + "line": 2, + "column": 14 + }, + { + "ruleId": "no-unused-vars", + "code": "c", + "line": 2, + "column": 17 + }, + { + "ruleId": "no-unused-vars", + "code": "everythingElse", + "line": 2, + "column": 23 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json new file mode 100644 index 00000000..080cd01a --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json @@ -0,0 +1,809 @@ +{ + "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": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "range": [ + 28, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 17, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "range": [ + 17, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + ], + "range": [ + 13, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 50 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 60, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 49 + }, + "end": { + "line": 2, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "range": [ + 0, + 70 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json new file mode 100644 index 00000000..ed9c5e82 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json @@ -0,0 +1,26 @@ +[ + { + "ruleId": "prefer-const", + "code": "a", + "line": 2, + "column": 11 + }, + { + "ruleId": "prefer-const", + "code": "b", + "line": 2, + "column": 14 + }, + { + "ruleId": "prefer-const", + "code": "c", + "line": 2, + "column": 17 + }, + { + "ruleId": "prefer-const", + "code": "everythingElse", + "line": 2, + "column": 23 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json new file mode 100644 index 00000000..9d026523 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json @@ -0,0 +1,1735 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "range": [ + 28, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 17, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "range": [ + 17, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "range": [ + 28, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 17, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "range": [ + 17, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ] + }, + { + "name": "c", + "identifiers": [ + { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "range": [ + 28, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 17, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "range": [ + 17, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ] + }, + { + "name": "everythingElse", + "identifiers": [ + { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "range": [ + 28, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 17, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "range": [ + 50, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "range": [ + 17, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "c", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 31, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte new file mode 100644 index 00000000..ab15709b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte @@ -0,0 +1,3 @@ + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json new file mode 100644 index 00000000..bd293a68 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "$props", + "line": 2, + "column": 42 + }, + { + "ruleId": "no-undef", + "code": "MyProps", + "line": 2, + "column": 49 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json new file mode 100644 index 00000000..ae6a736e --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json @@ -0,0 +1,26 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "a", + "line": 2, + "column": 11 + }, + { + "ruleId": "no-unused-vars", + "code": "b", + "line": 2, + "column": 14 + }, + { + "ruleId": "no-unused-vars", + "code": "c", + "line": 2, + "column": 17 + }, + { + "ruleId": "no-unused-vars", + "code": "everythingElse", + "line": 2, + "column": 23 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json new file mode 100644 index 00000000..8da44620 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json @@ -0,0 +1,1065 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "optional": false, + "range": [ + 38, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 27, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + "range": [ + 60, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 27, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 58 + } + } + } + ], + "range": [ + 23, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 59 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 79, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 88 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "lang", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "ts", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + { + "type": "Identifier", + "value": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 56 + }, + "end": { + "line": 2, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 57 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 81, + 87 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "range": [ + 0, + 89 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json new file mode 100644 index 00000000..ed9c5e82 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json @@ -0,0 +1,26 @@ +[ + { + "ruleId": "prefer-const", + "code": "a", + "line": 2, + "column": 11 + }, + { + "ruleId": "prefer-const", + "code": "b", + "line": 2, + "column": 14 + }, + { + "ruleId": "prefer-const", + "code": "c", + "line": 2, + "column": 17 + }, + { + "ruleId": "prefer-const", + "code": "everythingElse", + "line": 2, + "column": 23 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json new file mode 100644 index 00000000..65128ad5 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json @@ -0,0 +1,2024 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "a", + "identifiers": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "optional": false, + "range": [ + 38, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 27, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + "range": [ + 60, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 27, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 58 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + }, + { + "name": "b", + "identifiers": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "optional": false, + "range": [ + 38, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 27, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + "range": [ + 60, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 27, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 58 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ] + }, + { + "name": "c", + "identifiers": [ + { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "optional": false, + "range": [ + 38, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 27, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + "range": [ + 60, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 27, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 58 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + } + ] + }, + { + "name": "everythingElse", + "identifiers": [ + { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "optional": false, + "range": [ + 38, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "range": [ + 27, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "optional": false, + "typeArguments": { + "type": "TSTypeParameterInstantiation", + "params": [ + { + "type": "TSTypeReference", + "typeName": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "range": [ + 66, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 47 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + "range": [ + 60, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + "range": [ + 27, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 58 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "b", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "everythingElse", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte new file mode 100644 index 00000000..49126eaa --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte @@ -0,0 +1,2 @@ + + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json new file mode 100644 index 00000000..739d2d05 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json @@ -0,0 +1,390 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteHTMLComment", + "value": " this can be `true` or `false` ", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "special", + "name": { + "type": "SvelteName", + "name": "svelte:options", + "range": [ + 40, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "runes", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Literal", + "raw": "true", + "value": true, + "range": [ + 62, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 28 + } + } + } + ], + "range": [ + 55, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 28 + } + } + } + ], + "selfClosing": true, + "range": [ + 39, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 39, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "HTMLComment", + "value": "", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:options", + "range": [ + 40, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "runes", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 62, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + } + ], + "range": [ + 0, + 71 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json new file mode 100644 index 00000000..d392ca4b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json @@ -0,0 +1,34 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json new file mode 100644 index 00000000..a8a08140 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json @@ -0,0 +1,3 @@ +{ + "runes": true +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte new file mode 100644 index 00000000..66619ed4 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte @@ -0,0 +1,11 @@ + + + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json new file mode 100644 index 00000000..060e6fe9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 14 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json new file mode 100644 index 00000000..49e3817b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json @@ -0,0 +1,1421 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 60, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 60, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 56, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 35, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 75, + 84 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "range": [ + 0, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 84, + 86 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 97, + 102 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 94, + 102 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + "expression": { + "type": "Identifier", + "name": "increment", + "range": [ + 104, + 113 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "range": [ + 94, + 114 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 28 + } + } + } + ], + "selfClosing": false, + "range": [ + 86, + 115 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\tclicks: ", + "range": [ + 115, + 125 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "count", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 11, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 133, + 142 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "range": [ + 86, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 11, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "+=", + "range": [ + 66, + 68 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 77, + 83 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 84, + 86 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 94, + 96 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 97, + 102 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 104, + 113 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 115, + 117 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "clicks:", + "range": [ + 117, + 124 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 135, + 141 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 9 + } + } + } + ], + "range": [ + 0, + 143 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json new file mode 100644 index 00000000..2fb8c231 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json @@ -0,0 +1,802 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "increment", + "identifiers": [ + { + "type": "Identifier", + "name": "increment", + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "increment", + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 60, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 60, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 56, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 35, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 104, + 113 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 104, + 113 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 44, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "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 + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte new file mode 100644 index 00000000..05fb97ef --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte @@ -0,0 +1,20 @@ + + + diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json new file mode 100644 index 00000000..708e3131 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 3, + "column": 15 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json new file mode 100644 index 00000000..eaf4bc74 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json @@ -0,0 +1,2411 @@ +{ + "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": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 51, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "range": [ + 43, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 23 + } + } + } + ], + "range": [ + 39, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 91, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 91, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 14 + } + } + } + ], + "range": [ + 86, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "params": [], + "range": [ + 65, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 143, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "range": [ + 136, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 29 + } + } + } + ], + "range": [ + 134, + 150 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 131, + 150 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + "range": [ + 122, + 150 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "increment", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "increment", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + } + ], + "range": [ + 117, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + "range": [ + 110, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 12, + "column": 4 + } + } + } + ], + "range": [ + 35, + 172 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "params": [], + "range": [ + 10, + 172 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + "optional": false, + "range": [ + 191, + 206 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + "range": [ + 181, + 206 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 32 + } + } + } + ], + "range": [ + 175, + 207 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 33 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 208, + 217 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + "range": [ + 0, + 217 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 217, + 219 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 220, + 226 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 230, + 235 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 227, + 235 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "counter", + "range": [ + 237, + 244 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "increment", + "range": [ + 245, + 254 + ], + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + "range": [ + 237, + 254 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + "range": [ + 227, + 255 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 36 + } + } + } + ], + "selfClosing": false, + "range": [ + 219, + 256 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\tclicks: ", + "range": [ + 256, + 266 + ], + "loc": { + "start": { + "line": 18, + "column": 37 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "counter", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "count", + "range": [ + 275, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "range": [ + 267, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "range": [ + 266, + 281 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 19, + "column": 24 + }, + "end": { + "line": 20, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 282, + 291 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + "range": [ + 219, + 291 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 20, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "createCounter", + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "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": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "+=", + "range": [ + 97, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 122, + 125 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 136, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 143, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 10, + "column": 30 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 31 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 175, + 180 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "createCounter", + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 15, + "column": 31 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 216, + 217 + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 217, + 219 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 219, + 220 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 220, + 226 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 227, + 229 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 229, + 230 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 230, + 235 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 235, + 236 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "counter", + "range": [ + 237, + 244 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 18, + "column": 25 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 245, + 254 + ], + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 18, + "column": 35 + }, + "end": { + "line": 18, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 18, + "column": 36 + }, + "end": { + "line": 18, + "column": 37 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 256, + 258 + ], + "loc": { + "start": { + "line": 18, + "column": 37 + }, + "end": { + "line": 19, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "clicks:", + "range": [ + 258, + 265 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "counter", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 275, + 280 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 19, + "column": 24 + }, + "end": { + "line": 20, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 284, + 290 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 290, + 291 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + } + ], + "range": [ + 0, + 292 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 21, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json new file mode 100644 index 00000000..54e1a9a2 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json @@ -0,0 +1,1894 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "createCounter", + "identifiers": [ + { + "type": "Identifier", + "name": "createCounter", + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 51, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "range": [ + 43, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 23 + } + } + } + ], + "range": [ + 39, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 91, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 91, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 14 + } + } + } + ], + "range": [ + 86, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "params": [], + "range": [ + 65, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 143, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "range": [ + 136, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 29 + } + } + } + ], + "range": [ + 134, + 150 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 131, + 150 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + "range": [ + 122, + 150 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "increment", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "increment", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + } + ], + "range": [ + 117, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + "range": [ + 110, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 12, + "column": 4 + } + } + } + ], + "range": [ + 35, + 172 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "params": [], + "range": [ + 10, + 172 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ] + }, + { + "name": "counter", + "identifiers": [ + { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + "optional": false, + "range": [ + 191, + 206 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + "range": [ + 181, + 206 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 32 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "counter", + "range": [ + 237, + 244 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "counter", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 19, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "counter", + "range": [ + 237, + 244 + ], + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "counter", + "range": [ + 267, + 274 + ], + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "counter", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 51, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "range": [ + 43, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 143, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ] + }, + { + "name": "increment", + "identifiers": [ + { + "type": "Identifier", + "name": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 91, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 91, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 14 + } + } + } + ], + "range": [ + 86, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "params": [], + "range": [ + 65, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 20 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 143, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 143, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js new file mode 100644 index 00000000..73af2497 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js @@ -0,0 +1,14 @@ +export function createCounter() { + let count = $state(0); + + function increment() { + count += 1; + } + + return { + get count() { + return count; + }, + increment + }; +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json new file mode 100644 index 00000000..060e6fe9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 14 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json new file mode 100644 index 00000000..120d785e --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json @@ -0,0 +1,1270 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 39, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 35, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 81, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 60, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 117, + 122 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 130, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + ], + "range": [ + 125, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 122, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "range": [ + 113, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + } + ], + "range": [ + 109, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "range": [ + 102, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "range": [ + 32, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "params": [], + "range": [ + 7, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "source": null, + "specifiers": [], + "range": [ + 0, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "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": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "+=", + "range": [ + 91, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 102, + 108 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 117, + 122 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 130, + 136 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ], + "range": [ + 0, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json new file mode 100644 index 00000000..c8477856 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json @@ -0,0 +1,1433 @@ +{ + "type": "global", + "variables": [], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "createCounter", + "identifiers": [ + { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 39, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 35, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 81, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 60, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 117, + 122 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 130, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + ], + "range": [ + 125, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 122, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "range": [ + 113, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + } + ], + "range": [ + 109, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "range": [ + 102, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "range": [ + 32, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "params": [], + "range": [ + 7, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + } + ], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 39, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "increment", + "identifiers": [ + { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 81, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 60, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts new file mode 100644 index 00000000..73af2497 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts @@ -0,0 +1,14 @@ +export function createCounter() { + let count = $state(0); + + function increment() { + count += 1; + } + + return { + get count() { + return count; + }, + increment + }; +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json new file mode 100644 index 00000000..060e6fe9 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 2, + "column": 14 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json new file mode 100644 index 00000000..2bec2091 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json @@ -0,0 +1,1271 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 39, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 35, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 81, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 60, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 117, + 122 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 130, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + ], + "range": [ + 125, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 122, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "range": [ + 113, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + } + ], + "range": [ + 109, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "range": [ + 102, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "range": [ + 32, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "params": [], + "range": [ + 7, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "exportKind": "value", + "source": null, + "specifiers": [], + "range": [ + 0, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "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": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "+=", + "range": [ + 91, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 102, + 108 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 113, + 116 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 117, + 122 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 130, + 136 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ], + "range": [ + 0, + 167 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json new file mode 100644 index 00000000..c8477856 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json @@ -0,0 +1,1433 @@ +{ + "type": "global", + "variables": [], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "createCounter", + "identifiers": [ + { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 39, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 35, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 81, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 60, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "get", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 117, + 122 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 130, + 143 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + ], + "range": [ + 125, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 122, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "range": [ + 113, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + } + ], + "range": [ + 109, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "range": [ + 102, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "range": [ + 32, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "createCounter", + "range": [ + 16, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "params": [], + "range": [ + 7, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + } + ], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 39, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "increment", + "identifiers": [ + { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "operator": "+=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 85, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "range": [ + 81, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "params": [], + "range": [ + 60, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "function", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "increment", + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "increment", + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 19 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts new file mode 100644 index 00000000..08bfcd3b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts @@ -0,0 +1,14 @@ +export function createCounter() { // createCounter: () => { readonly count: number; increment: () => void; } + let count = $state(0); // count: number, $state(0): 0 + + function increment() { // increment: () => void + count += 1; // count: number + } + + return { + get count() { // count: number + return count; // count: number + }, + increment // increment: () => void, increment: () => void + }; +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json new file mode 100644 index 00000000..a8a08140 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json @@ -0,0 +1,3 @@ +{ + "runes": true +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json new file mode 100644 index 00000000..936eb3cb --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json @@ -0,0 +1,3 @@ +{ + "runes": false +} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte new file mode 100644 index 00000000..246836b4 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte @@ -0,0 +1,12 @@ + + + + + + +

{count} doubled is {double}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json new file mode 100644 index 00000000..e7523aa5 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "$state", + "line": 4, + "column": 14 + }, + { + "ruleId": "no-undef", + "code": "$derived", + "line": 5, + "column": 15 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json new file mode 100644 index 00000000..2f0bd0fe --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json @@ -0,0 +1,2371 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteElement", + "kind": "special", + "name": { + "type": "SvelteName", + "name": "svelte:options", + "range": [ + 1, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "runes", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Literal", + "raw": "true", + "value": true, + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "selfClosing": true, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 3, + "column": 0 + } + } + }, + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 34, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 33, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 55, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 47, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 22 + } + } + } + ], + "range": [ + 43, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + "range": [ + 89, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 80, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + "range": [ + 71, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 33 + } + } + } + ], + "range": [ + 67, + 100 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 34 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 101, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 33, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 110, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 113, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "EventHandler", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "click", + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "modifiers": [], + "range": [ + 120, + 128 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 136, + 141 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 136, + 143 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 130, + 143 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + "range": [ + 120, + 144 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 32 + } + } + } + ], + "selfClosing": false, + "range": [ + 112, + 145 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 33 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 145, + 147 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "double", + "range": [ + 148, + 154 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "range": [ + 147, + 155 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 156, + 165 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + "range": [ + 112, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 165, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 167, + 170 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "count", + "range": [ + 171, + 176 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "range": [ + 170, + 177 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": " doubled is ", + "range": [ + 177, + 189 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 22 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "double", + "range": [ + 190, + 196 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "range": [ + 189, + 197 + ], + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 197, + 201 + ], + "loc": { + "start": { + "line": 12, + "column": 30 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + "range": [ + 167, + 201 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 34 + } + } + } + ], + "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:options", + "range": [ + 1, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "runes", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "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": "HTMLText", + "value": "\n\n", + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 3, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 34, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 67, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$derived", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 5, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 103, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 110, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 113, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "on", + "range": [ + 120, + 122 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "click", + "range": [ + 123, + 128 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 133, + 135 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 136, + 141 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 141, + 143 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 8, + "column": 33 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 145, + 147 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 148, + 154 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 158, + 164 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 165, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 171, + 176 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "doubled", + "range": [ + 178, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "is", + "range": [ + 186, + 188 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "double", + "range": [ + 190, + 196 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 12, + "column": 30 + }, + "end": { + "line": 12, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 31 + }, + "end": { + "line": 12, + "column": 32 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + } + ], + "range": [ + 0, + 202 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 13, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json new file mode 100644 index 00000000..e58a7e7c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "double", + "line": 5, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json new file mode 100644 index 00000000..1a7b924f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json @@ -0,0 +1,1102 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 55, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 47, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 136, + 141 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 171, + 176 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + } + ] + }, + { + "name": "double", + "identifiers": [ + { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "operator": "*", + "right": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + "range": [ + 89, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 32 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$derived", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 80, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + "range": [ + 71, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 33 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 148, + 154 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 190, + 196 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 148, + 154 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 171, + 176 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "double", + "range": [ + 190, + 196 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "double", + "range": [ + 71, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 136, + 141 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 136, + 141 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/src/parser/test-utils.ts b/tests/src/parser/test-utils.ts index 3cb6cc24..ab996440 100644 --- a/tests/src/parser/test-utils.ts +++ b/tests/src/parser/test-utils.ts @@ -208,21 +208,29 @@ function* listupFixturesImpl(dir: string): Iterable<{ continue; } - if (filename.endsWith("input.svelte")) { + if ( + filename.endsWith("input.svelte") || + filename.endsWith("input.svelte.js") || + filename.endsWith("input.svelte.ts") + ) { const outputFileName = inputFileName.replace( - /input\.svelte$/u, + /input\.svelte(?:\.[jt]s)?$/u, "output.json", ); const typeFileName = inputFileName.replace( - /input\.svelte$/u, - "type-output.svelte", + /input\.svelte(\.[jt]s)?$/u, + "type-output.svelte$1", ); - const configFileName = inputFileName.replace( - /input\.svelte$/u, + const configFileNameForFile = inputFileName.replace( + /input\.svelte(?:\.[jt]s)?$/u, "config.json", ); + const configFileNameForDir = path.join( + path.dirname(inputFileName), + "_config.json", + ); const requirementsFileName = inputFileName.replace( - /input\.svelte$/u, + /input\.svelte(?:\.[jt]s)?$/u, "requirements.json", ); @@ -230,9 +238,18 @@ function* listupFixturesImpl(dir: string): Iterable<{ const requirements = fs.existsSync(requirementsFileName) ? JSON.parse(fs.readFileSync(requirementsFileName, "utf-8")) : {}; - const config = fs.existsSync(configFileName) - ? JSON.parse(fs.readFileSync(configFileName, "utf-8")) - : {}; + const config = {}; + for (const configFileName of [ + configFileNameForDir, + configFileNameForFile, + ]) { + if (fs.existsSync(configFileName)) { + Object.assign( + config, + JSON.parse(fs.readFileSync(configFileName, "utf-8")), + ); + } + } yield { input, inputFileName, diff --git a/tests/src/parser/typescript/index.ts b/tests/src/parser/typescript/index.ts index 2b6489e2..94170c02 100644 --- a/tests/src/parser/typescript/index.ts +++ b/tests/src/parser/typescript/index.ts @@ -1,5 +1,5 @@ import { Context } from "../../../../src/context"; -import { parseScript } from "../../../../src/parser/script"; +import { parseScriptInSvelte } from "../../../../src/parser/script"; import { parseTemplate } from "../../../../src/parser/template"; import { parseTypeScript } from "../../../../src/parser/typescript"; import { generateParserOptions, listupFixtures } from "../test-utils"; @@ -42,7 +42,7 @@ describe("Check for typescript analyze result.", () => { const analyzedResult = parseTypeScript(code, attrs, parserOptions, { slots: new Set(), }); - const result = parseScript( + const result = parseScriptInSvelte( code.script + code.render, attrs, parserOptions, diff --git a/tools/update-fixtures.ts b/tools/update-fixtures.ts index beaec29b..96c3340a 100644 --- a/tools/update-fixtures.ts +++ b/tools/update-fixtures.ts @@ -88,7 +88,11 @@ for (const { writeScopeFile(scopeJson); if (typeFileName) { - fs.writeFileSync(typeFileName, buildTypes(input, result), "utf8"); + fs.writeFileSync( + typeFileName, + buildTypes(input, result, inputFileName), + "utf8", + ); } } catch (e) { // eslint-disable-next-line no-console -- ignore @@ -159,6 +163,7 @@ for (const { input, inputFileName, outputFileName, config } of listupFixtures( STYLE_LOCATION_FIXTURE_ROOT, )) { const services = parse(input, inputFileName, config).services; + if (!services.isSvelte) continue; const styleContext = services.getStyleContext(); if (styleContext.status !== "success") { continue; @@ -200,28 +205,33 @@ function buildTypes( services: Record; visitorKeys: { [type: string]: string[] }; }, + inputFileName: string, ): string { const scriptLineRange: [number, number][] = []; - parser.traverseNodes(result.ast, { - enterNode(node) { - if (node.type === "SvelteScriptElement" && node.body.length) { - scriptLineRange.push([ - node.body[0].loc!.start.line - 1, - node.body[node.body.length - 1].loc!.end.line - 1, - ]); - } - if (node.type === "SvelteDirective" && node.expression) { - if (node.expression.loc!.start.line !== node.expression.loc!.end.line) + if (inputFileName.endsWith(".svelte")) { + parser.traverseNodes(result.ast, { + enterNode(node) { + if (node.type === "SvelteScriptElement" && node.body.length) { scriptLineRange.push([ - node.expression.loc!.start.line - 1, - node.expression.loc!.end.line - 2, + node.body[0].loc!.start.line - 1, + node.body[node.body.length - 1].loc!.end.line - 1, ]); - } - }, - leaveNode() { - // noop - }, - }); + } + if (node.type === "SvelteDirective" && node.expression) { + if (node.expression.loc!.start.line !== node.expression.loc!.end.line) + scriptLineRange.push([ + node.expression.loc!.start.line - 1, + node.expression.loc!.end.line - 2, + ]); + } + }, + leaveNode() { + // noop + }, + }); + } else { + scriptLineRange.push([0, Infinity]); + } const tsNodeMap: ReadonlyMap = result.services.esTreeNodeToTSNodeMap; From faf9e47099109d12d607174e06846b4d19d1c2b4 Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Wed, 15 Nov 2023 09:59:06 +0900 Subject: [PATCH 02/15] feat: add `svelteFeatures.runes` option and add rune symbols to global scope --- README.md | 45 +- src/context/index.ts | 2 + src/parser/analyze-scope.ts | 24 + src/parser/converts/element.ts | 22 +- src/parser/index.ts | 28 +- .../docs/fine-grained-reactivity/_config.json | 4 +- .../example01-no-undef-result.json | 20 - .../example01-scope-output.json | 163 +-- .../functions/01-untrack-no-undef-result.json | 14 - .../functions/01-untrack-scope-output.json | 118 +- .../docs/functions/_config.json | 4 +- .../01-counter-no-undef-result.json | 20 - .../old-vs-new/01-counter-scope-output.json | 165 +-- ...tracking-dependencies-no-undef-result.json | 20 - ...02-tracking-dependencies-scope-output.json | 167 +-- ...tracking-dependencies-no-undef-result.json | 20 - ...-untracking-dependencies-scope-output.json | 167 +-- ...imple-component-props-no-undef-result.json | 8 - ...4-simple-component-props-scope-output.json | 74 +- ...anced-component-props-no-undef-result.json | 8 - ...advanced-component-props-scope-output.json | 71 +- .../06-autoscroll-no-undef-result.json | 18 - .../06-autoscroll-scope-output.json | 164 +-- .../docs/old-vs-new/_config.json | 4 +- .../docs/runes/01-$state-no-undef-result.json | 8 - .../docs/runes/01-$state-scope-output.json | 74 +- .../runes/02-$derived-no-undef-result.json | 14 - .../docs/runes/02-$derived-scope-output.json | 121 +- .../runes/03-$effect-no-undef-result.json | 20 - .../docs/runes/03-$effect-scope-output.json | 165 +-- .../docs/runes/04-$effect-pre-input.svelte | 2 +- .../runes/04-$effect-pre-no-undef-result.json | 14 - .../docs/runes/04-$effect-pre-output.json | 154 +-- .../runes/04-$effect-pre-scope-output.json | 265 ++-- .../docs/runes/05-$props-no-undef-result.json | 8 - .../docs/runes/05-$props-scope-output.json | 74 +- .../docs/runes/06-$props-no-undef-result.json | 8 - .../docs/runes/06-$props-scope-output.json | 74 +- .../docs/runes/07-$props-no-undef-result.json | 8 - .../docs/runes/07-$props-scope-output.json | 74 +- .../docs/runes/08-$props-ts-input.svelte | 1 + .../runes/08-$props-ts-no-undef-result.json | 14 - .../08-$props-ts-no-unused-vars-result.json | 8 +- .../docs/runes/08-$props-ts-output.json | 493 +++++--- .../08-$props-ts-prefer-const-result.json | 8 +- .../docs/runes/08-$props-ts-scope-output.json | 1064 ++++++++++------- .../runes/09-how-to-opt-in-scope-output.json | 24 + .../svelte-5-preview/docs/runes/_config.json | 4 +- .../01-no-undef-result.json | 8 - .../universal-reactivity/01-scope-output.json | 74 +- .../02-no-undef-result.json | 8 - .../universal-reactivity/02-scope-output.json | 74 +- .../03-no-undef-result.json | 8 - .../universal-reactivity/03-scope-output.json | 77 +- .../03-ts-no-undef-result.json | 8 - .../03-ts-scope-output.json | 77 +- .../docs/universal-reactivity/_config.json | 4 +- .../optin-runes01-config.json | 4 +- .../optin-runes01-no-undef-result.json | 14 - .../optin-runes01-scope-output.json | 121 +- tests/src/parser/parser.ts | 30 +- 61 files changed, 2605 insertions(+), 1951 deletions(-) delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json diff --git a/README.md b/README.md index eb165462..caac5f0c 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,22 @@ module.exports = { } ``` -### parserOptions.runes +### parserOptions.svelteFeatures + +You can use `parserOptions.svelteFeatures` property to specify how to parse related to Svelte features. For example: + +```json +{ + "parser": "svelte-eslint-parser", + "parserOptions": { + "svelteFeatures": { + "runes": false + } + } +} +``` + +#### parserOptions.svelteFeatures.runes ***This is an experimental feature. It may be changed or removed in minor versions without notice.*** @@ -179,7 +194,9 @@ If set to `true`, Rune symbols will be parsed. In this mode, the parser also par { "parser": "svelte-eslint-parser", "parserOptions": { - "runes": true + "svelteFeatures": { + "runes": true // Default `false` + } } } ``` @@ -193,7 +210,9 @@ When using this mode in an ESLint configuration, it is recommended to set it per "files": ["*.svelte"], "parser": "svelte-eslint-parser", "parserOptions": { - "runes": true, + "svelteFeatures": { + "runes": true, + }, "parser": "...", ... } @@ -202,7 +221,9 @@ When using this mode in an ESLint configuration, it is recommended to set it per "files": ["*.svelte.js"], "parser": "svelte-eslint-parser", "parserOptions": { - "runes": true, + "svelteFeatures": { + "runes": true, + }, ... } }, @@ -210,7 +231,9 @@ When using this mode in an ESLint configuration, it is recommended to set it per "files": ["*.svelte.ts"], "parser": "svelte-eslint-parser", "parserOptions": { - "runes": true, + "svelteFeatures": { + "runes": true, + }, "parser": "...(ts parser)...", ... } @@ -219,6 +242,18 @@ When using this mode in an ESLint configuration, it is recommended to set it per } ``` +Even if `runes` is not set to `true`, if it is enabled in the `` of the `*.svelte` file, it will be parsed as `runes` mode is enabled + +```svelte + +``` + +Also, even if `runes` is set to `true`, if it is disabled in the `` of the `*.svelte` file, it will be parsed as `runes` mode is disabled. + +```svelte + +``` + ## :computer: Editor Integrations ### Visual Studio Code diff --git a/src/context/index.ts b/src/context/index.ts index 66168e1c..666db773 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -136,6 +136,8 @@ export class Context { public readonly slots = new Set(); + public runes: boolean | null = null; + public readonly elements = new Map< SvelteElement, | SvAST.InlineComponent diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts index d42b4fca..337e216a 100644 --- a/src/parser/analyze-scope.ts +++ b/src/parser/analyze-scope.ts @@ -217,6 +217,30 @@ export function analyzePropsScope( } } +/** Analyze Runes. e.g. $state() */ +export function analyzeRunesScope(scopeManager: ScopeManager): void { + const globalScope = scopeManager.globalScope; + // https://svelte-5-preview.vercel.app/docs/runes + for (const $name of ["$state", "$derived", "$effect", "$props"]) { + if (globalScope.set.has($name)) continue; + const variable = new Variable(); + variable.name = $name; + (variable as any).scope = globalScope; + globalScope.variables.push(variable); + globalScope.set.set($name, variable); + globalScope.through = globalScope.through.filter((reference) => { + if (reference.identifier.name === $name) { + // Links the variable and the reference. + // And this reference is removed from `Scope#through`. + reference.resolved = variable; + addReference(variable.references, reference); + return false; + } + return true; + }); + } +} + /** Remove reference from through */ function removeReferenceFromThrough(reference: Reference, baseScope: Scope) { const variable = reference.resolved!; diff --git a/src/parser/converts/element.ts b/src/parser/converts/element.ts index 2c44cbef..87ce96ba 100644 --- a/src/parser/converts/element.ts +++ b/src/parser/converts/element.ts @@ -810,7 +810,27 @@ function convertOptionsElement( parent: SvelteSpecialElement["parent"], ctx: Context, ): SvelteSpecialElement { - return convertSpecialElement(node, parent, ctx); + const element = convertSpecialElement(node, parent, ctx); + + // Extract rune mode from options. + for (const attr of node.attributes) { + if (attr.type === "Attribute" && attr.name === "runes") { + if (attr.value === true) { + ctx.runes = true; + } else if (attr.value.length === 1) { + const val = attr.value[0]; + if ( + val.type === "MustacheTag" && + val.expression.type === "Literal" && + typeof val.expression.value === "boolean" + ) { + ctx.runes = val.expression.value; + } + } + } + } + + return element; } /** Convert for element. */ diff --git a/src/parser/index.ts b/src/parser/index.ts index 1e31e661..cf1f1c00 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -17,6 +17,7 @@ import { parseTemplate } from "./template"; import { analyzePropsScope, analyzeReactiveScope, + analyzeRunesScope, analyzeStoreScope, } from "./analyze-scope"; import { ParseError } from "../errors"; @@ -65,11 +66,11 @@ type ParseResult = { ( | { isSvelte: true; - svelteRunes: boolean; + svelteOptions: { runes: boolean }; getSvelteHtmlAst: () => SvAST.Fragment; getStyleContext: () => StyleContext; } - | { isSvelte: false; svelteRunes: boolean } + | { isSvelte: false; svelteOptions: { runes: boolean } } ); visitorKeys: { [type: string]: string[] }; scopeManager: ScopeManager; @@ -83,7 +84,7 @@ export function parseForESLint(code: string, options?: any): ParseResult { if ( parserOptions.filePath && !parserOptions.filePath.endsWith(".svelte") && - parserOptions.runes + parserOptions.svelteFeatures.runes ) { const trimmed = code.trim(); if (!trimmed.startsWith("<") && !trimmed.endsWith(">")) { @@ -108,6 +109,8 @@ function parseAsSvelte( parserOptions, ); + const runes = ctx.runes ?? parserOptions.svelteFeatures.runes; + const scripts = ctx.sourceCode.scripts; const resultScript = ctx.isTypeScript() ? parseTypeScript( @@ -132,8 +135,9 @@ function parseAsSvelte( analyzeStoreScope(resultScript.scopeManager!); // for reactive vars // Add $$xxx variable + const globalScope = resultScript.scopeManager!.globalScope; for (const $$name of globals) { - const globalScope = resultScript.scopeManager!.globalScope; + if (globalScope.set.has($$name)) continue; const variable = new Variable(); variable.name = $$name; (variable as any).scope = globalScope; @@ -151,6 +155,10 @@ function parseAsSvelte( }); } + if (runes) { + analyzeRunesScope(resultScript.scopeManager!); + } + const ast = resultTemplate.ast; const statements = [...resultScript.ast.body]; @@ -204,6 +212,7 @@ function parseAsSvelte( resultScript.ast = ast as any; resultScript.services = Object.assign(resultScript.services || {}, { isSvelte: true, + svelteOptions: { runes }, getSvelteHtmlAst() { return resultTemplate.svelteAst.html; }, @@ -229,11 +238,11 @@ function parseAsScript( parserOptions: NormalizedParserOptions, ): ParseResult { const lang = parserOptions.filePath?.split(".").pop() || "js"; - // TODO support runes const resultScript = parseScript(code, { lang }, parserOptions); + analyzeRunesScope(resultScript.scopeManager!); resultScript.services = Object.assign(resultScript.services || {}, { isSvelte: false, - runes: parserOptions.runes, + svelteOptions: { runes: true }, }); resultScript.visitorKeys = Object.assign({}, KEYS, resultScript.visitorKeys); return resultScript as any; @@ -249,7 +258,7 @@ type NormalizedParserOptions = { comment: boolean; eslintVisitorKeys: boolean; eslintScopeManager: boolean; - runes: boolean; + svelteFeatures: { runes: boolean }; filePath?: string; }; @@ -265,7 +274,10 @@ function normalizeParserOptions(options: any): NormalizedParserOptions { comment: true, eslintVisitorKeys: true, eslintScopeManager: true, - rune: false, + svelteFeatures: { + rune: false, + ...(options?.svelteFeatures || {}), + }, ...(options || {}), }; parserOptions.sourceType = "module"; diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json index a8a08140..cd6d9516 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json @@ -1,3 +1,5 @@ { - "runes": true + "svelteFeatures": { + "runes": true + } } diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json deleted file mode 100644 index 9012ef61..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-undef-result.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 14 - }, - { - "ruleId": "no-undef", - "code": "$state", - "line": 12, - "column": 14 - }, - { - "ruleId": "no-undef", - "code": "$state", - "line": 13, - "column": 14 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json index 47527a01..7dd00c92 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json @@ -18,6 +18,100 @@ "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": [ + 228, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -6670,29 +6764,6 @@ } ], "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", @@ -6715,52 +6786,6 @@ "from": "function", "init": null, "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json deleted file mode 100644 index 8888d901..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-no-undef-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$props", - "line": 4, - "column": 17 - }, - { - "ruleId": "no-undef", - "code": "$effect", - "line": 6, - "column": 2 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json index 2ba15778..7b0c1e2a 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json @@ -18,6 +18,78 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] } ], "references": [], @@ -1415,52 +1487,6 @@ } ], "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 73, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, { "identifier": { "type": "Identifier", diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json index a8a08140..cd6d9516 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json @@ -1,3 +1,5 @@ { - "runes": true + "svelteFeatures": { + "runes": true + } } diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json deleted file mode 100644 index e02eeb79..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-no-undef-result.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 3, - "column": 14 - }, - { - "ruleId": "no-undef", - "code": "$derived", - "line": 4, - "column": 15 - }, - { - "ruleId": "no-undef", - "code": "$effect", - "line": 5, - "column": 2 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json index b3bfc990..cf2097bb 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json @@ -18,6 +18,102 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -1249,75 +1345,6 @@ } ], "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, { "identifier": { "type": "Identifier", diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json deleted file mode 100644 index 2ad5ad0c..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-no-undef-result.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 10 - }, - { - "ruleId": "no-undef", - "code": "$state", - "line": 3, - "column": 10 - }, - { - "ruleId": "no-undef", - "code": "$derived", - "line": 4, - "column": 12 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json index e56d77cc..9e59b1ee 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json @@ -18,6 +18,101 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 60, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -1861,75 +1956,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json deleted file mode 100644 index e8df7260..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-no-undef-result.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 4, - "column": 10 - }, - { - "ruleId": "no-undef", - "code": "$state", - "line": 5, - "column": 10 - }, - { - "ruleId": "no-undef", - "code": "$derived", - "line": 6, - "column": 12 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json index d298cd8c..35f01e12 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json @@ -18,6 +18,101 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 74, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -2192,75 +2287,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 96, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json deleted file mode 100644 index 6f4beb4c..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$props", - "line": 2, - "column": 22 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json index bbcd0151..0cde141e 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] } ], "references": [], @@ -533,29 +581,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json deleted file mode 100644 index 628f52b7..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$props", - "line": 2, - "column": 40 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json index 6ef2b559..aeae4efe 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] } ], "references": [], @@ -872,29 +920,6 @@ } ], "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, { "identifier": { "type": "Identifier", diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json index 6ae46930..6086a019 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json @@ -1,22 +1,4 @@ [ - { - "ruleId": "no-undef", - "code": "$state", - "line": 4, - "column": 14 - }, - { - "ruleId": "no-undef", - "code": "$state", - "line": 5, - "column": 17 - }, - { - "ruleId": "no-undef", - "code": "$effect", - "line": 9, - "column": 2 - }, { "ruleId": "no-undef", "code": "toggleValue", diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json index 64b003a4..be2b1ddf 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json @@ -18,6 +18,101 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -6097,75 +6192,6 @@ } ], "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, { "identifier": { "type": "Identifier", diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json index a8a08140..cd6d9516 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json @@ -1,3 +1,5 @@ { - "runes": true + "svelteFeatures": { + "runes": true + } } diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json deleted file mode 100644 index 060e6fe9..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 14 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json index 55f86dd8..49fb45fa 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -509,29 +557,5 @@ ] } ], - "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 - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json deleted file mode 100644 index 52df4003..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-no-undef-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 14 - }, - { - "ruleId": "no-undef", - "code": "$derived", - "line": 3, - "column": 15 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json index f298c5aa..d0aede02 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json @@ -18,6 +18,78 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -1051,52 +1123,5 @@ ] } ], - "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": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json deleted file mode 100644 index 0567ec77..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-no-undef-result.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 14 - }, - { - "ruleId": "no-undef", - "code": "$derived", - "line": 3, - "column": 15 - }, - { - "ruleId": "no-undef", - "code": "$effect", - "line": 5, - "column": 2 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json index 5476e492..683ea63d 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json @@ -18,6 +18,102 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -1518,75 +1614,6 @@ } ], "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": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, { "identifier": { "type": "Identifier", diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte index e3a9afbe..8ed4e55f 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte @@ -22,7 +22,7 @@
- {#each message as message} + {#each messages as message}

{message}

{/each}
diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json deleted file mode 100644 index 50127dc7..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-undef-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$effect", - "line": 9, - "column": 2 - }, - { - "ruleId": "no-undef", - "code": "message", - "line": 25, - "column": 9 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json index 185ba70a..aa092cde 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json @@ -1283,10 +1283,10 @@ "type": "SvelteEachBlock", "expression": { "type": "Identifier", - "name": "message", + "name": "messages", "range": [ 457, - 464 + 465 ], "loc": { "start": { @@ -1295,7 +1295,7 @@ }, "end": { "line": 25, - "column": 15 + "column": 16 } } }, @@ -1303,17 +1303,17 @@ "type": "Identifier", "name": "message", "range": [ - 468, - 475 + 469, + 476 ], "loc": { "start": { "line": 25, - "column": 19 + "column": 20 }, "end": { "line": 25, - "column": 26 + "column": 27 } } }, @@ -1327,8 +1327,8 @@ "type": "SvelteName", "name": "p", "range": [ - 480, - 481 + 481, + 482 ], "loc": { "start": { @@ -1346,8 +1346,8 @@ "attributes": [], "selfClosing": false, "range": [ - 479, - 482 + 480, + 483 ], "loc": { "start": { @@ -1368,8 +1368,8 @@ "type": "Identifier", "name": "message", "range": [ - 483, - 490 + 484, + 491 ], "loc": { "start": { @@ -1383,8 +1383,8 @@ } }, "range": [ - 482, - 491 + 483, + 492 ], "loc": { "start": { @@ -1401,8 +1401,8 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 491, - 495 + 492, + 496 ], "loc": { "start": { @@ -1416,8 +1416,8 @@ } }, "range": [ - 479, - 495 + 480, + 496 ], "loc": { "start": { @@ -1434,7 +1434,7 @@ "else": null, "range": [ 450, - 504 + 505 ], "loc": { "start": { @@ -1451,8 +1451,8 @@ "type": "SvelteText", "value": "\n", "range": [ - 504, - 505 + 505, + 506 ], "loc": { "start": { @@ -1469,8 +1469,8 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 505, - 511 + 506, + 512 ], "loc": { "start": { @@ -1485,7 +1485,7 @@ }, "range": [ 427, - 511 + 512 ], "loc": { "start": { @@ -3359,10 +3359,10 @@ }, { "type": "Identifier", - "value": "message", + "value": "messages", "range": [ 457, - 464 + 465 ], "loc": { "start": { @@ -3371,7 +3371,7 @@ }, "end": { "line": 25, - "column": 15 + "column": 16 } } }, @@ -3379,17 +3379,17 @@ "type": "Keyword", "value": "as", "range": [ - 465, - 467 + 466, + 468 ], "loc": { "start": { "line": 25, - "column": 16 + "column": 17 }, "end": { "line": 25, - "column": 18 + "column": 19 } } }, @@ -3397,17 +3397,17 @@ "type": "Identifier", "value": "message", "range": [ - 468, - 475 + 469, + 476 ], "loc": { "start": { "line": 25, - "column": 19 + "column": 20 }, "end": { "line": 25, - "column": 26 + "column": 27 } } }, @@ -3415,17 +3415,17 @@ "type": "Punctuator", "value": "}", "range": [ - 475, - 476 + 476, + 477 ], "loc": { "start": { "line": 25, - "column": 26 + "column": 27 }, "end": { "line": 25, - "column": 27 + "column": 28 } } }, @@ -3433,8 +3433,8 @@ "type": "Punctuator", "value": "<", "range": [ - 479, - 480 + 480, + 481 ], "loc": { "start": { @@ -3451,8 +3451,8 @@ "type": "HTMLIdentifier", "value": "p", "range": [ - 480, - 481 + 481, + 482 ], "loc": { "start": { @@ -3469,8 +3469,8 @@ "type": "Punctuator", "value": ">", "range": [ - 481, - 482 + 482, + 483 ], "loc": { "start": { @@ -3487,8 +3487,8 @@ "type": "Punctuator", "value": "{", "range": [ - 482, - 483 + 483, + 484 ], "loc": { "start": { @@ -3505,8 +3505,8 @@ "type": "Identifier", "value": "message", "range": [ - 483, - 490 + 484, + 491 ], "loc": { "start": { @@ -3523,8 +3523,8 @@ "type": "Punctuator", "value": "}", "range": [ - 490, - 491 + 491, + 492 ], "loc": { "start": { @@ -3541,8 +3541,8 @@ "type": "Punctuator", "value": "<", "range": [ - 491, - 492 + 492, + 493 ], "loc": { "start": { @@ -3559,8 +3559,8 @@ "type": "Punctuator", "value": "/", "range": [ - 492, - 493 + 493, + 494 ], "loc": { "start": { @@ -3577,8 +3577,8 @@ "type": "HTMLIdentifier", "value": "p", "range": [ - 493, - 494 + 494, + 495 ], "loc": { "start": { @@ -3595,8 +3595,8 @@ "type": "Punctuator", "value": ">", "range": [ - 494, - 495 + 495, + 496 ], "loc": { "start": { @@ -3613,8 +3613,8 @@ "type": "Punctuator", "value": "{", "range": [ - 497, - 498 + 498, + 499 ], "loc": { "start": { @@ -3631,8 +3631,8 @@ "type": "MustacheKeyword", "value": "/each", "range": [ - 498, - 503 + 499, + 504 ], "loc": { "start": { @@ -3649,8 +3649,8 @@ "type": "Punctuator", "value": "}", "range": [ - 503, - 504 + 504, + 505 ], "loc": { "start": { @@ -3667,8 +3667,8 @@ "type": "HTMLText", "value": "\n", "range": [ - 504, - 505 + 505, + 506 ], "loc": { "start": { @@ -3685,8 +3685,8 @@ "type": "Punctuator", "value": "<", "range": [ - 505, - 506 + 506, + 507 ], "loc": { "start": { @@ -3703,8 +3703,8 @@ "type": "Punctuator", "value": "/", "range": [ - 506, - 507 + 507, + 508 ], "loc": { "start": { @@ -3721,8 +3721,8 @@ "type": "HTMLIdentifier", "value": "div", "range": [ - 507, - 510 + 508, + 511 ], "loc": { "start": { @@ -3739,8 +3739,8 @@ "type": "Punctuator", "value": ">", "range": [ - 510, - 511 + 511, + 512 ], "loc": { "start": { @@ -3756,7 +3756,7 @@ ], "range": [ 0, - 512 + 513 ], "loc": { "start": { diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json index 598cb574..ab3d910e 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 83, + 90 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -708,6 +756,46 @@ } } } + }, + { + "identifier": { + "type": "Identifier", + "name": "messages", + "range": [ + 457, + 465 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } } ] } @@ -819,10 +907,10 @@ { "identifier": { "type": "Identifier", - "name": "message", + "name": "messages", "range": [ 457, - 464 + 465 ], "loc": { "start": { @@ -831,13 +919,30 @@ }, "end": { "line": 25, - "column": 15 + "column": 16 } } }, "from": "module", "init": null, - "resolved": null + "resolved": { + "type": "Identifier", + "name": "messages", + "range": [ + 57, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 13 + } + } + } } ], "childScopes": [ @@ -1720,17 +1825,17 @@ "type": "Identifier", "name": "message", "range": [ - 468, - 475 + 469, + 476 ], "loc": { "start": { "line": 25, - "column": 19 + "column": 20 }, "end": { "line": 25, - "column": 26 + "column": 27 } } } @@ -1742,17 +1847,17 @@ "type": "Identifier", "name": "message", "range": [ - 468, - 475 + 469, + 476 ], "loc": { "start": { "line": 25, - "column": 19 + "column": 20 }, "end": { "line": 25, - "column": 26 + "column": 27 } } }, @@ -1760,10 +1865,10 @@ "type": "SvelteEachBlock", "expression": { "type": "Identifier", - "name": "message", + "name": "messages", "range": [ 457, - 464 + 465 ], "loc": { "start": { @@ -1772,7 +1877,7 @@ }, "end": { "line": 25, - "column": 15 + "column": 16 } } }, @@ -1780,17 +1885,17 @@ "type": "Identifier", "name": "message", "range": [ - 468, - 475 + 469, + 476 ], "loc": { "start": { "line": 25, - "column": 19 + "column": 20 }, "end": { "line": 25, - "column": 26 + "column": 27 } } }, @@ -1804,8 +1909,8 @@ "type": "SvelteName", "name": "p", "range": [ - 480, - 481 + 481, + 482 ], "loc": { "start": { @@ -1823,8 +1928,8 @@ "attributes": [], "selfClosing": false, "range": [ - 479, - 482 + 480, + 483 ], "loc": { "start": { @@ -1845,8 +1950,8 @@ "type": "Identifier", "name": "message", "range": [ - 483, - 490 + 484, + 491 ], "loc": { "start": { @@ -1860,8 +1965,8 @@ } }, "range": [ - 482, - 491 + 483, + 492 ], "loc": { "start": { @@ -1878,8 +1983,8 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 491, - 495 + 492, + 496 ], "loc": { "start": { @@ -1893,8 +1998,8 @@ } }, "range": [ - 479, - 495 + 480, + 496 ], "loc": { "start": { @@ -1911,7 +2016,7 @@ "else": null, "range": [ 450, - 504 + 505 ], "loc": { "start": { @@ -1932,8 +2037,8 @@ "type": "Identifier", "name": "message", "range": [ - 483, - 490 + 484, + 491 ], "loc": { "start": { @@ -1952,17 +2057,17 @@ "type": "Identifier", "name": "message", "range": [ - 468, - 475 + 469, + 476 ], "loc": { "start": { "line": 25, - "column": 19 + "column": 20 }, "end": { "line": 25, - "column": 26 + "column": 27 } } } @@ -1976,8 +2081,8 @@ "type": "Identifier", "name": "message", "range": [ - 483, - 490 + 484, + 491 ], "loc": { "start": { @@ -1996,17 +2101,17 @@ "type": "Identifier", "name": "message", "range": [ - 468, - 475 + 469, + 476 ], "loc": { "start": { "line": 25, - "column": 19 + "column": 20 }, "end": { "line": 25, - "column": 26 + "column": 27 } } } @@ -2039,79 +2144,9 @@ "from": "module", "init": null, "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "message", - "range": [ - 457, - 464 - ], - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null } ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 83, - 90 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "message", - "range": [ - 457, - 464 - ], - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json deleted file mode 100644 index 63db00b8..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$props", - "line": 2, - "column": 47 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json index eb02f053..6a56a722 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] } ], "references": [], @@ -861,29 +909,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json deleted file mode 100644 index d13cc8c1..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$props", - "line": 2, - "column": 31 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json index 26644c36..2b5aa6ea 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 39, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] } ], "references": [], @@ -337,29 +385,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json deleted file mode 100644 index 0fd845f6..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$props", - "line": 2, - "column": 42 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json index 9d026523..308e284e 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] } ], "references": [], @@ -1707,29 +1755,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte index ab15709b..9fa47908 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte @@ -1,3 +1,4 @@ diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json deleted file mode 100644 index bd293a68..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-undef-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$props", - "line": 2, - "column": 42 - }, - { - "ruleId": "no-undef", - "code": "MyProps", - "line": 2, - "column": 49 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json index ae6a736e..70377cef 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json @@ -2,25 +2,25 @@ { "ruleId": "no-unused-vars", "code": "a", - "line": 2, + "line": 3, "column": 11 }, { "ruleId": "no-unused-vars", "code": "b", - "line": 2, + "line": 3, "column": 14 }, { "ruleId": "no-unused-vars", "code": "c", - "line": 2, + "line": 3, "column": 17 }, { "ruleId": "no-unused-vars", "code": "everythingElse", - "line": 2, + "line": 3, "column": 23 } ] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json index 8da44620..9ce52f34 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json @@ -98,6 +98,59 @@ } }, "body": [ + { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "typeAnnotation": { + "type": "TSTypeLiteral", + "members": [], + "range": [ + 38, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 23, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, { "type": "VariableDeclaration", "kind": "let", @@ -115,16 +168,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -135,31 +188,31 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } }, "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -172,16 +225,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -192,31 +245,31 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } }, "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -229,16 +282,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -249,31 +302,31 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } }, "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -284,48 +337,48 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } }, "optional": false, "range": [ - 38, - 55 + 60, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 19 }, "end": { - "line": 2, + "line": 3, "column": 36 } } } ], "range": [ - 27, - 57 + 49, + 79 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 38 } } @@ -337,16 +390,16 @@ "type": "Identifier", "name": "$props", "range": [ - 60, - 66 + 82, + 88 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 47 } } @@ -361,93 +414,93 @@ "type": "Identifier", "name": "MyProps", "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } }, "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } } ], "range": [ - 66, - 75 + 88, + 97 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 47 }, "end": { - "line": 2, + "line": 3, "column": 56 } } }, "range": [ - 60, - 77 + 82, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 58 } } }, "range": [ - 27, - 77 + 49, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 58 } } } ], "range": [ - 23, - 78 + 45, + 100 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 4 }, "end": { - "line": 2, + "line": 3, "column": 59 } } @@ -456,23 +509,23 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 79, - 88 + 101, + 110 ], "loc": { "start": { - "line": 3, + "line": 4, "column": 0 }, "end": { - "line": 3, + "line": 4, "column": 9 } } }, "range": [ 0, - 88 + 110 ], "loc": { "start": { @@ -480,7 +533,7 @@ "column": 0 }, "end": { - "line": 3, + "line": 4, "column": 9 } } @@ -634,11 +687,11 @@ } }, { - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "type", "range": [ 23, - 26 + 27 ], "loc": { "start": { @@ -647,7 +700,43 @@ }, "end": { "line": 2, - "column": 7 + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "MyProps", + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 } } }, @@ -655,16 +744,70 @@ "type": "Punctuator", "value": "{", "range": [ - 27, - 28 + 38, + 39 ], "loc": { "start": { "line": 2, - "column": 8 + "column": 19 }, "end": { "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 45, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, "column": 9 } } @@ -673,16 +816,16 @@ "type": "Identifier", "value": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -691,16 +834,16 @@ "type": "Punctuator", "value": ",", "range": [ - 30, - 31 + 52, + 53 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 11 }, "end": { - "line": 2, + "line": 3, "column": 12 } } @@ -709,16 +852,16 @@ "type": "Identifier", "value": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -727,16 +870,16 @@ "type": "Punctuator", "value": ",", "range": [ - 33, - 34 + 55, + 56 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 14 }, "end": { - "line": 2, + "line": 3, "column": 15 } } @@ -745,16 +888,16 @@ "type": "Identifier", "value": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -763,16 +906,16 @@ "type": "Punctuator", "value": ",", "range": [ - 36, - 37 + 58, + 59 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 17 }, "end": { - "line": 2, + "line": 3, "column": 18 } } @@ -781,16 +924,16 @@ "type": "Punctuator", "value": "...", "range": [ - 38, - 41 + 60, + 63 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 19 }, "end": { - "line": 2, + "line": 3, "column": 22 } } @@ -799,16 +942,16 @@ "type": "Identifier", "value": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } @@ -817,16 +960,16 @@ "type": "Punctuator", "value": "}", "range": [ - 56, - 57 + 78, + 79 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 37 }, "end": { - "line": 2, + "line": 3, "column": 38 } } @@ -835,16 +978,16 @@ "type": "Punctuator", "value": "=", "range": [ - 58, - 59 + 80, + 81 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 39 }, "end": { - "line": 2, + "line": 3, "column": 40 } } @@ -853,16 +996,16 @@ "type": "Identifier", "value": "$props", "range": [ - 60, - 66 + 82, + 88 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 47 } } @@ -871,16 +1014,16 @@ "type": "Punctuator", "value": "<", "range": [ - 66, - 67 + 88, + 89 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 47 }, "end": { - "line": 2, + "line": 3, "column": 48 } } @@ -889,16 +1032,16 @@ "type": "Identifier", "value": "MyProps", "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } @@ -907,16 +1050,16 @@ "type": "Punctuator", "value": ">", "range": [ - 74, - 75 + 96, + 97 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 55 }, "end": { - "line": 2, + "line": 3, "column": 56 } } @@ -925,16 +1068,16 @@ "type": "Punctuator", "value": "(", "range": [ - 75, - 76 + 97, + 98 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 56 }, "end": { - "line": 2, + "line": 3, "column": 57 } } @@ -943,16 +1086,16 @@ "type": "Punctuator", "value": ")", "range": [ - 76, - 77 + 98, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 57 }, "end": { - "line": 2, + "line": 3, "column": 58 } } @@ -961,16 +1104,16 @@ "type": "Punctuator", "value": ";", "range": [ - 77, - 78 + 99, + 100 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 58 }, "end": { - "line": 2, + "line": 3, "column": 59 } } @@ -979,16 +1122,16 @@ "type": "Punctuator", "value": "<", "range": [ - 79, - 80 + 101, + 102 ], "loc": { "start": { - "line": 3, + "line": 4, "column": 0 }, "end": { - "line": 3, + "line": 4, "column": 1 } } @@ -997,16 +1140,16 @@ "type": "Punctuator", "value": "/", "range": [ - 80, - 81 + 102, + 103 ], "loc": { "start": { - "line": 3, + "line": 4, "column": 1 }, "end": { - "line": 3, + "line": 4, "column": 2 } } @@ -1015,16 +1158,16 @@ "type": "HTMLIdentifier", "value": "script", "range": [ - 81, - 87 + 103, + 109 ], "loc": { "start": { - "line": 3, + "line": 4, "column": 2 }, "end": { - "line": 3, + "line": 4, "column": 8 } } @@ -1033,16 +1176,16 @@ "type": "Punctuator", "value": ">", "range": [ - 87, - 88 + 109, + 110 ], "loc": { "start": { - "line": 3, + "line": 4, "column": 8 }, "end": { - "line": 3, + "line": 4, "column": 9 } } @@ -1050,7 +1193,7 @@ ], "range": [ 0, - 89 + 111 ], "loc": { "start": { @@ -1058,7 +1201,7 @@ "column": 0 }, "end": { - "line": 4, + "line": 5, "column": 0 } } diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json index ed9c5e82..368783a9 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json @@ -2,25 +2,25 @@ { "ruleId": "prefer-const", "code": "a", - "line": 2, + "line": 3, "column": 11 }, { "ruleId": "prefer-const", "code": "b", - "line": 2, + "line": 3, "column": 14 }, { "ruleId": "prefer-const", "code": "c", - "line": 2, + "line": 3, "column": 17 }, { "ruleId": "prefer-const", "code": "everythingElse", - "line": 2, + "line": 3, "column": 23 } ] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json index 65128ad5..e81f27c0 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 82, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 41 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] } ], "references": [], @@ -25,6 +73,147 @@ { "type": "module", "variables": [ + { + "name": "MyProps", + "identifiers": [ + { + "type": "Identifier", + "name": "MyProps", + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "defs": [ + { + "type": "Type", + "name": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "node": { + "type": "TSTypeAliasDeclaration", + "id": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "typeAnnotation": { + "type": "TSTypeLiteral", + "members": [], + "range": [ + 38, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 23, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 89, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 48 + }, + "end": { + "line": 3, + "column": 55 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "MyProps", + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + } + ] + }, { "name": "a", "identifiers": [ @@ -32,16 +221,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -54,16 +243,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -81,16 +270,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -101,31 +290,31 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } }, "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -138,16 +327,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -158,31 +347,31 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } }, "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -195,16 +384,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -215,31 +404,31 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } }, "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -250,48 +439,48 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } }, "optional": false, "range": [ - 38, - 55 + 60, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 19 }, "end": { - "line": 2, + "line": 3, "column": 36 } } } ], "range": [ - 27, - 57 + 49, + 79 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 38 } } @@ -303,16 +492,16 @@ "type": "Identifier", "name": "$props", "range": [ - 60, - 66 + 82, + 88 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 47 } } @@ -327,77 +516,77 @@ "type": "Identifier", "name": "MyProps", "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } }, "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } } ], "range": [ - 66, - 75 + 88, + 97 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 47 }, "end": { - "line": 2, + "line": 3, "column": 56 } } }, "range": [ - 60, - 77 + 82, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 58 } } }, "range": [ - 27, - 77 + 49, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 58 } } @@ -410,16 +599,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -430,16 +619,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -454,16 +643,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -476,16 +665,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -503,16 +692,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -523,31 +712,31 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } }, "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -560,16 +749,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -580,31 +769,31 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } }, "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -617,16 +806,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -637,31 +826,31 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } }, "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -672,48 +861,48 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } }, "optional": false, "range": [ - 38, - 55 + 60, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 19 }, "end": { - "line": 2, + "line": 3, "column": 36 } } } ], "range": [ - 27, - 57 + 49, + 79 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 38 } } @@ -725,16 +914,16 @@ "type": "Identifier", "name": "$props", "range": [ - 60, - 66 + 82, + 88 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 47 } } @@ -749,77 +938,77 @@ "type": "Identifier", "name": "MyProps", "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } }, "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } } ], "range": [ - 66, - 75 + 88, + 97 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 47 }, "end": { - "line": 2, + "line": 3, "column": 56 } } }, "range": [ - 60, - 77 + 82, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 58 } } }, "range": [ - 27, - 77 + 49, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 58 } } @@ -832,16 +1021,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -852,16 +1041,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -876,16 +1065,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -898,16 +1087,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -925,16 +1114,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -945,31 +1134,31 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } }, "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -982,16 +1171,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -1002,31 +1191,31 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } }, "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -1039,16 +1228,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1059,31 +1248,31 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } }, "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1094,48 +1283,48 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } }, "optional": false, "range": [ - 38, - 55 + 60, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 19 }, "end": { - "line": 2, + "line": 3, "column": 36 } } } ], "range": [ - 27, - 57 + 49, + 79 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 38 } } @@ -1147,16 +1336,16 @@ "type": "Identifier", "name": "$props", "range": [ - 60, - 66 + 82, + 88 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 47 } } @@ -1171,77 +1360,77 @@ "type": "Identifier", "name": "MyProps", "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } }, "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } } ], "range": [ - 66, - 75 + 88, + 97 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 47 }, "end": { - "line": 2, + "line": 3, "column": 56 } } }, "range": [ - 60, - 77 + 82, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 58 } } }, "range": [ - 27, - 77 + 49, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 58 } } @@ -1254,16 +1443,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1274,16 +1463,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1298,16 +1487,16 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } @@ -1320,16 +1509,16 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } @@ -1347,16 +1536,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -1367,31 +1556,31 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } }, "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -1404,16 +1593,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -1424,31 +1613,31 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } }, "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -1461,16 +1650,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1481,31 +1670,31 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } }, "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1516,48 +1705,48 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } }, "optional": false, "range": [ - 38, - 55 + 60, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 19 }, "end": { - "line": 2, + "line": 3, "column": 36 } } } ], "range": [ - 27, - 57 + 49, + 79 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 38 } } @@ -1569,16 +1758,16 @@ "type": "Identifier", "name": "$props", "range": [ - 60, - 66 + 82, + 88 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 47 } } @@ -1593,77 +1782,77 @@ "type": "Identifier", "name": "MyProps", "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } }, "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } } ], "range": [ - 66, - 75 + 88, + 97 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 47 }, "end": { - "line": 2, + "line": 3, "column": 56 } } }, "range": [ - 60, - 77 + 82, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 58 } } }, "range": [ - 27, - 77 + 49, + 99 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 8 }, "end": { - "line": 2, + "line": 3, "column": 58 } } @@ -1676,16 +1865,16 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } @@ -1696,16 +1885,16 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } @@ -1720,16 +1909,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -1740,16 +1929,16 @@ "type": "Identifier", "name": "a", "range": [ - 29, - 30 + 51, + 52 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 10 }, "end": { - "line": 2, + "line": 3, "column": 11 } } @@ -1760,16 +1949,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -1780,16 +1969,16 @@ "type": "Identifier", "name": "b", "range": [ - 32, - 33 + 54, + 55 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 13 }, "end": { - "line": 2, + "line": 3, "column": 14 } } @@ -1800,16 +1989,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1820,16 +2009,16 @@ "type": "Identifier", "name": "c", "range": [ - 35, - 36 + 57, + 58 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 16 }, "end": { - "line": 2, + "line": 3, "column": 17 } } @@ -1840,16 +2029,16 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } @@ -1860,16 +2049,16 @@ "type": "Identifier", "name": "everythingElse", "range": [ - 41, - 55 + 63, + 77 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 22 }, "end": { - "line": 2, + "line": 3, "column": 36 } } @@ -1880,16 +2069,16 @@ "type": "Identifier", "name": "$props", "range": [ - 60, - 66 + 82, + 88 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 41 }, "end": { - "line": 2, + "line": 3, "column": 47 } } @@ -1903,66 +2092,60 @@ "type": "Identifier", "name": "MyProps", "range": [ - 67, - 74 + 89, + 96 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 48 }, "end": { - "line": 2, + "line": 3, "column": 55 } } }, "from": "module", "init": null, - "resolved": null - } - ], - "childScopes": [], - "through": [ - { - "identifier": { + "resolved": { "type": "Identifier", - "name": "$props", + "name": "MyProps", "range": [ - 60, - 66 + 28, + 35 ], "loc": { "start": { "line": 2, - "column": 41 + "column": 9 }, "end": { "line": 2, - "column": 47 + "column": 16 } } - }, - "from": "module", - "init": null, - "resolved": null - }, + } + } + ], + "childScopes": [], + "through": [ { "identifier": { "type": "Identifier", - "name": "MyProps", + "name": "$props", "range": [ - 67, - 74 + 82, + 88 ], "loc": { "start": { - "line": 2, - "column": 48 + "line": 3, + "column": 41 }, "end": { - "line": 2, - "column": 55 + "line": 3, + "column": 47 } } }, @@ -1973,52 +2156,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 60, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 67, - 74 - ], - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 2, - "column": 55 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json index d392ca4b..fbcac79c 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json @@ -18,6 +18,30 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json index a8a08140..cd6d9516 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json @@ -1,3 +1,5 @@ { - "runes": true + "svelteFeatures": { + "runes": true + } } diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json deleted file mode 100644 index 060e6fe9..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 14 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json index 2fb8c231..c28d4d8b 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -774,29 +822,5 @@ ] } ], - "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 - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json deleted file mode 100644 index 708e3131..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 3, - "column": 15 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json index 54e1a9a2..f177577d 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json @@ -18,6 +18,54 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 51, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -1866,29 +1914,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json deleted file mode 100644 index 060e6fe9..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 14 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json index c8477856..ff248e38 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json @@ -1,6 +1,55 @@ { "type": "global", - "variables": [], + "variables": [ + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], "references": [], "childScopes": [ { @@ -1405,29 +1454,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json deleted file mode 100644 index 060e6fe9..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-no-undef-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 2, - "column": 14 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json index c8477856..ff248e38 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json @@ -1,6 +1,55 @@ { "type": "global", - "variables": [], + "variables": [ + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], "references": [], "childScopes": [ { @@ -1405,29 +1454,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json index a8a08140..cd6d9516 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json @@ -1,3 +1,5 @@ { - "runes": true + "svelteFeatures": { + "runes": true + } } diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json index 936eb3cb..cd6d9516 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json @@ -1,3 +1,5 @@ { - "runes": false + "svelteFeatures": { + "runes": true + } } diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json deleted file mode 100644 index e7523aa5..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-no-undef-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "$state", - "line": 4, - "column": 14 - }, - { - "ruleId": "no-undef", - "code": "$derived", - "line": 5, - "column": 15 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json index 1a7b924f..efac15fe 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json @@ -18,6 +18,78 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$derived", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], @@ -1051,52 +1123,5 @@ ] } ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] + "through": [] } \ No newline at end of file diff --git a/tests/src/parser/parser.ts b/tests/src/parser/parser.ts index 5da904be..ab9a102f 100644 --- a/tests/src/parser/parser.ts +++ b/tests/src/parser/parser.ts @@ -141,23 +141,27 @@ function checkLoc(ast: SvelteProgram, fileName: string, code: string) { ); } set.add(node); + const nodeParent = (node as any).parent; if (parent?.type.startsWith("Svelte")) { assert.ok( - (node as any).parent?.type === parent?.type, - `Parent type mismatch [${(node as any).parent - ?.type} : ${parent?.type}] @${astToJson(node)}`, + nodeParent?.type === parent?.type, + `Parent type mismatch [${nodeParent?.type} : ${parent?.type}] @${astToJson( + node, + )}`, + ); + } + if (nodeParent) { + assert.ok( + nodeParent.range?.[0] === parent?.range![0], + `Parent range mismatch [${nodeParent + ?.range?.[0]} : ${parent?.range![0]}] @${astToJson(node)}`, + ); + assert.ok( + nodeParent.range?.[1] === parent?.range![1], + `Parent range mismatch [${nodeParent + ?.range?.[1]} : ${parent?.range![1]}] @${astToJson(node)}`, ); } - assert.ok( - (node as any).parent?.range?.[0] === parent?.range![0], - `Parent range mismatch [${(node as any).parent - ?.range?.[0]} : ${parent?.range![0]}] @${astToJson(node)}`, - ); - assert.ok( - (node as any).parent?.range?.[1] === parent?.range![1], - `Parent range mismatch [${(node as any).parent - ?.range?.[1]} : ${parent?.range![1]}] @${astToJson(node)}`, - ); assert.ok( node.range![0] < node.range![1], `No range on "${node.type} line:${node.loc!.start.line} col:${ From b1fa6852e72a76bffb007e511e5086c91ea35528 Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Wed, 15 Nov 2023 10:12:16 +0900 Subject: [PATCH 03/15] fix --- .../docs/runes/08-$props-ts-requirements.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json new file mode 100644 index 00000000..e218e93c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json @@ -0,0 +1,8 @@ +{ + "test": { + "@typescript-eslint/parser": ">=5.0.0" + }, + "scope": { + "@typescript-eslint/parser": ">=6.5.0" + } +} \ No newline at end of file From 5d582ad019c25b9657fcf8453634480f7c45165e Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Wed, 15 Nov 2023 10:12:48 +0900 Subject: [PATCH 04/15] Create brown-cheetahs-greet.md --- .changeset/brown-cheetahs-greet.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/brown-cheetahs-greet.md diff --git a/.changeset/brown-cheetahs-greet.md b/.changeset/brown-cheetahs-greet.md new file mode 100644 index 00000000..69cc168e --- /dev/null +++ b/.changeset/brown-cheetahs-greet.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: add `svelteFeatures.runes` option and add rune symbols to global scope From df56f933e6b2becf56e8a7ec070e25cd8a28e9a7 Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Wed, 15 Nov 2023 10:20:05 +0900 Subject: [PATCH 05/15] fix --- .../svelte-5-preview/docs/runes/08-$props-ts-requirements.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json index e218e93c..e03dc5ca 100644 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json @@ -1,6 +1,6 @@ { "test": { - "@typescript-eslint/parser": ">=5.0.0" + "@typescript-eslint/parser": ">=6.0.0" }, "scope": { "@typescript-eslint/parser": ">=6.5.0" From df67d708ed3821652d4c88671c5d522b98870b6b Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Wed, 15 Nov 2023 10:29:21 +0900 Subject: [PATCH 06/15] fix --- .../svelte-5-preview/docs/runes/06-$props-requirements.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json new file mode 100644 index 00000000..ba9b7a52 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json @@ -0,0 +1,5 @@ +{ + "test": { + "eslint": ">=8.0.0" + } +} \ No newline at end of file From 30b5a47ac82d6cb1916bc57bf954fa726e5c992e Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Wed, 15 Nov 2023 10:50:33 +0900 Subject: [PATCH 07/15] fix --- .../old-vs-new/05-advanced-component-props-requirements.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json new file mode 100644 index 00000000..ba9b7a52 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json @@ -0,0 +1,5 @@ +{ + "test": { + "eslint": ">=8.0.0" + } +} \ No newline at end of file From 64bd95a2654956dc650f604b14f4e31f4d2ac320 Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Fri, 17 Nov 2023 13:40:54 +0900 Subject: [PATCH 08/15] fix --- .changeset/brown-cheetahs-greet.md | 2 +- README.md | 51 +------------------ package.json | 2 +- src/context/index.ts | 2 - src/parser/analyze-scope.ts | 24 --------- src/parser/converts/element.ts | 22 +------- src/parser/globals.ts | 12 +++-- src/parser/index.ts | 50 ++++++++++-------- src/parser/svelte-version.ts | 10 ++++ src/parser/typescript/analyze/index.ts | 8 +-- .../docs/fine-grained-reactivity/_config.json | 5 -- .../docs/functions/_config.json | 5 -- .../docs/old-vs-new/_config.json | 5 -- .../svelte-5-preview/docs/runes/_config.json | 5 -- .../docs/universal-reactivity/_config.json | 5 -- .../optin-runes01-config.json | 5 -- tests/src/parser/test-utils.ts | 8 +-- 17 files changed, 61 insertions(+), 160 deletions(-) create mode 100644 src/parser/svelte-version.ts delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json diff --git a/.changeset/brown-cheetahs-greet.md b/.changeset/brown-cheetahs-greet.md index 69cc168e..e32592a5 100644 --- a/.changeset/brown-cheetahs-greet.md +++ b/.changeset/brown-cheetahs-greet.md @@ -2,4 +2,4 @@ "svelte-eslint-parser": minor --- -feat: add `svelteFeatures.runes` option and add rune symbols to global scope +feat: apply runes to `*.svelte.js` and `*.svelte.ts`. diff --git a/README.md b/README.md index caac5f0c..717578b2 100644 --- a/README.md +++ b/README.md @@ -169,37 +169,11 @@ module.exports = { } ``` -### parserOptions.svelteFeatures - -You can use `parserOptions.svelteFeatures` property to specify how to parse related to Svelte features. For example: - -```json -{ - "parser": "svelte-eslint-parser", - "parserOptions": { - "svelteFeatures": { - "runes": false - } - } -} -``` - -#### parserOptions.svelteFeatures.runes +### Runes support ***This is an experimental feature. It may be changed or removed in minor versions without notice.*** -If set to `true`, Rune symbols will be parsed. In this mode, the parser also parses files other than `*.svelte`. - -```json -{ - "parser": "svelte-eslint-parser", - "parserOptions": { - "svelteFeatures": { - "runes": true // Default `false` - } - } -} -``` +If you install Svelte v5 the parser will be able to parse runes, and will also be able to parse `*.js` and `*.ts` files. When using this mode in an ESLint configuration, it is recommended to set it per file pattern as below. @@ -210,9 +184,6 @@ When using this mode in an ESLint configuration, it is recommended to set it per "files": ["*.svelte"], "parser": "svelte-eslint-parser", "parserOptions": { - "svelteFeatures": { - "runes": true, - }, "parser": "...", ... } @@ -221,9 +192,6 @@ When using this mode in an ESLint configuration, it is recommended to set it per "files": ["*.svelte.js"], "parser": "svelte-eslint-parser", "parserOptions": { - "svelteFeatures": { - "runes": true, - }, ... } }, @@ -231,9 +199,6 @@ When using this mode in an ESLint configuration, it is recommended to set it per "files": ["*.svelte.ts"], "parser": "svelte-eslint-parser", "parserOptions": { - "svelteFeatures": { - "runes": true, - }, "parser": "...(ts parser)...", ... } @@ -242,18 +207,6 @@ When using this mode in an ESLint configuration, it is recommended to set it per } ``` -Even if `runes` is not set to `true`, if it is enabled in the `` of the `*.svelte` file, it will be parsed as `runes` mode is enabled - -```svelte - -``` - -Also, even if `runes` is set to `true`, if it is disabled in the `` of the `*.svelte` file, it will be parsed as `runes` mode is disabled. - -```svelte - -``` - ## :computer: Editor Integrations ### Visual Studio Code diff --git a/package.json b/package.json index 954e77d7..08abe35a 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "prettier-plugin-svelte": "^3.0.0", "rimraf": "^5.0.1", "semver": "^7.5.1", - "svelte": "^5.0.0-next.2", + "svelte": "^4.2.4", "svelte2tsx": "^0.6.25", "typescript": "~5.1.3", "typescript-eslint-parser-for-extra-files": "^0.5.0" diff --git a/src/context/index.ts b/src/context/index.ts index 666db773..66168e1c 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -136,8 +136,6 @@ export class Context { public readonly slots = new Set(); - public runes: boolean | null = null; - public readonly elements = new Map< SvelteElement, | SvAST.InlineComponent diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts index 337e216a..d42b4fca 100644 --- a/src/parser/analyze-scope.ts +++ b/src/parser/analyze-scope.ts @@ -217,30 +217,6 @@ export function analyzePropsScope( } } -/** Analyze Runes. e.g. $state() */ -export function analyzeRunesScope(scopeManager: ScopeManager): void { - const globalScope = scopeManager.globalScope; - // https://svelte-5-preview.vercel.app/docs/runes - for (const $name of ["$state", "$derived", "$effect", "$props"]) { - if (globalScope.set.has($name)) continue; - const variable = new Variable(); - variable.name = $name; - (variable as any).scope = globalScope; - globalScope.variables.push(variable); - globalScope.set.set($name, variable); - globalScope.through = globalScope.through.filter((reference) => { - if (reference.identifier.name === $name) { - // Links the variable and the reference. - // And this reference is removed from `Scope#through`. - reference.resolved = variable; - addReference(variable.references, reference); - return false; - } - return true; - }); - } -} - /** Remove reference from through */ function removeReferenceFromThrough(reference: Reference, baseScope: Scope) { const variable = reference.resolved!; diff --git a/src/parser/converts/element.ts b/src/parser/converts/element.ts index 87ce96ba..2c44cbef 100644 --- a/src/parser/converts/element.ts +++ b/src/parser/converts/element.ts @@ -810,27 +810,7 @@ function convertOptionsElement( parent: SvelteSpecialElement["parent"], ctx: Context, ): SvelteSpecialElement { - const element = convertSpecialElement(node, parent, ctx); - - // Extract rune mode from options. - for (const attr of node.attributes) { - if (attr.type === "Attribute" && attr.name === "runes") { - if (attr.value === true) { - ctx.runes = true; - } else if (attr.value.length === 1) { - const val = attr.value[0]; - if ( - val.type === "MustacheTag" && - val.expression.type === "Literal" && - typeof val.expression.value === "boolean" - ) { - ctx.runes = val.expression.value; - } - } - } - } - - return element; + return convertSpecialElement(node, parent, ctx); } /** Convert for element. */ diff --git a/src/parser/globals.ts b/src/parser/globals.ts index 9c3824dd..c406569d 100644 --- a/src/parser/globals.ts +++ b/src/parser/globals.ts @@ -1,16 +1,20 @@ -import { VERSION as SVELTE_VERSION } from "svelte/compiler"; +import { svelteVersion } from "./svelte-version"; const globalsForSvelte4: Readonly = [ "$$slots", "$$props", "$$restProps", ] as const; -export const globalsForSvelte5 = [ +export const globalsForRunes = [ "$state", "$derived", "$effect", "$props", ] as const; -export const globals = SVELTE_VERSION.startsWith("5") - ? [...globalsForSvelte4, ...globalsForSvelte5] +const globalsForSvelte5 = [...globalsForSvelte4, ...globalsForRunes]; +export const globals = svelteVersion.gte(5) + ? globalsForSvelte5 : globalsForSvelte4; +export const globalsForSvelteScript = svelteVersion.gte(5) + ? globalsForRunes + : []; diff --git a/src/parser/index.ts b/src/parser/index.ts index cf1f1c00..96816657 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -17,7 +17,6 @@ import { parseTemplate } from "./template"; import { analyzePropsScope, analyzeReactiveScope, - analyzeRunesScope, analyzeStoreScope, } from "./analyze-scope"; import { ParseError } from "../errors"; @@ -33,7 +32,8 @@ import { styleNodeLoc, styleNodeRange, } from "./style-context"; -import { globals } from "./globals"; +import { globals, globalsForSvelteScript } from "./globals"; +import { svelteVersion } from "./svelte-version"; export { StyleContext, @@ -66,11 +66,11 @@ type ParseResult = { ( | { isSvelte: true; - svelteOptions: { runes: boolean }; + isSvelteScript: false; getSvelteHtmlAst: () => SvAST.Fragment; getStyleContext: () => StyleContext; } - | { isSvelte: false; svelteOptions: { runes: boolean } } + | { isSvelte: false; isSvelteScript: true } ); visitorKeys: { [type: string]: string[] }; scopeManager: ScopeManager; @@ -82,9 +82,9 @@ export function parseForESLint(code: string, options?: any): ParseResult { const parserOptions = normalizeParserOptions(options); if ( + svelteVersion.hasRunes && parserOptions.filePath && - !parserOptions.filePath.endsWith(".svelte") && - parserOptions.svelteFeatures.runes + !parserOptions.filePath.endsWith(".svelte") ) { const trimmed = code.trim(); if (!trimmed.startsWith("<") && !trimmed.endsWith(">")) { @@ -109,8 +109,6 @@ function parseAsSvelte( parserOptions, ); - const runes = ctx.runes ?? parserOptions.svelteFeatures.runes; - const scripts = ctx.sourceCode.scripts; const resultScript = ctx.isTypeScript() ? parseTypeScript( @@ -155,10 +153,6 @@ function parseAsSvelte( }); } - if (runes) { - analyzeRunesScope(resultScript.scopeManager!); - } - const ast = resultTemplate.ast; const statements = [...resultScript.ast.body]; @@ -212,7 +206,7 @@ function parseAsSvelte( resultScript.ast = ast as any; resultScript.services = Object.assign(resultScript.services || {}, { isSvelte: true, - svelteOptions: { runes }, + isSvelteScript: false, getSvelteHtmlAst() { return resultTemplate.svelteAst.html; }, @@ -239,10 +233,31 @@ function parseAsScript( ): ParseResult { const lang = parserOptions.filePath?.split(".").pop() || "js"; const resultScript = parseScript(code, { lang }, parserOptions); - analyzeRunesScope(resultScript.scopeManager!); + + // Add $$xxx variable + const globalScope = resultScript.scopeManager!.globalScope; + for (const $$name of globalsForSvelteScript) { + if (globalScope.set.has($$name)) continue; + const variable = new Variable(); + variable.name = $$name; + (variable as any).scope = globalScope; + globalScope.variables.push(variable); + globalScope.set.set($$name, variable); + globalScope.through = globalScope.through.filter((reference) => { + if (reference.identifier.name === $$name) { + // Links the variable and the reference. + // And this reference is removed from `Scope#through`. + reference.resolved = variable; + addReference(variable.references, reference); + return false; + } + return true; + }); + } + resultScript.services = Object.assign(resultScript.services || {}, { isSvelte: false, - svelteOptions: { runes: true }, + isSvelteScript: true, }); resultScript.visitorKeys = Object.assign({}, KEYS, resultScript.visitorKeys); return resultScript as any; @@ -258,7 +273,6 @@ type NormalizedParserOptions = { comment: boolean; eslintVisitorKeys: boolean; eslintScopeManager: boolean; - svelteFeatures: { runes: boolean }; filePath?: string; }; @@ -274,10 +288,6 @@ function normalizeParserOptions(options: any): NormalizedParserOptions { comment: true, eslintVisitorKeys: true, eslintScopeManager: true, - svelteFeatures: { - rune: false, - ...(options?.svelteFeatures || {}), - }, ...(options || {}), }; parserOptions.sourceType = "module"; diff --git a/src/parser/svelte-version.ts b/src/parser/svelte-version.ts new file mode 100644 index 00000000..9c859aee --- /dev/null +++ b/src/parser/svelte-version.ts @@ -0,0 +1,10 @@ +import { VERSION as SVELTE_VERSION } from "svelte/compiler"; + +const verStrings = SVELTE_VERSION.split("."); + +export const svelteVersion = { + gte(v: number): boolean { + return Number(verStrings[0]) >= v; + }, + hasRunes: Number(verStrings[0]) >= 5, +}; diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts index 4f9e4b1e..54e27923 100644 --- a/src/parser/typescript/analyze/index.ts +++ b/src/parser/typescript/analyze/index.ts @@ -16,7 +16,7 @@ import { VirtualTypeScriptContext } from "../context"; import type { TSESParseForESLintResult } from "../types"; import type ESTree from "estree"; import type { SvelteAttribute, SvelteHTMLElement } from "../../../ast"; -import { globalsForSvelte5, globals } from "../../../parser/globals"; +import { globalsForRunes, globals } from "../../../parser/globals"; export type AnalyzeTypeScriptContext = { slots: Set; @@ -215,10 +215,10 @@ function analyzeDollarDollarVariables( ); } - addSvelte5Globals(); + addSvelteRuneGlobals(); - function addSvelte5Globals() { - for (const svelte5Global of globalsForSvelte5) { + function addSvelteRuneGlobals() { + for (const svelte5Global of globalsForRunes) { if ( !scopeManager.globalScope!.through.some( (reference) => reference.identifier.name === svelte5Global, diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json deleted file mode 100644 index cd6d9516..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/_config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "svelteFeatures": { - "runes": true - } -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json deleted file mode 100644 index cd6d9516..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/_config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "svelteFeatures": { - "runes": true - } -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json deleted file mode 100644 index cd6d9516..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/_config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "svelteFeatures": { - "runes": true - } -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json deleted file mode 100644 index cd6d9516..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/_config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "svelteFeatures": { - "runes": true - } -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json deleted file mode 100644 index cd6d9516..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/_config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "svelteFeatures": { - "runes": true - } -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json deleted file mode 100644 index cd6d9516..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "svelteFeatures": { - "runes": true - } -} diff --git a/tests/src/parser/test-utils.ts b/tests/src/parser/test-utils.ts index ab996440..9eb42dc5 100644 --- a/tests/src/parser/test-utils.ts +++ b/tests/src/parser/test-utils.ts @@ -1,5 +1,4 @@ /* global require -- node */ -import { VERSION as SVELTE_VERSION } from "svelte/compiler"; import path from "path"; import fs from "fs"; import semver from "semver"; @@ -10,6 +9,7 @@ import type * as TSESScopes from "@typescript-eslint/scope-manager"; import type { SvelteNode } from "../../../src/ast"; import type { StyleContext } from "../../../src"; import { TS_GLOBALS } from "./ts-vars"; +import { svelteVersion } from "../../../src/parser/svelte-version"; const AST_FIXTURE_ROOT = path.resolve(__dirname, "../../fixtures/parser/ast"); const BASIC_PARSER_OPTIONS: Linter.ParserOptions = { @@ -100,7 +100,7 @@ function getScopeFile(inputFileName: string, isSvelte5Only: boolean) { ); if (!fs.existsSync(scopeFileName)) return null; const scopeFile = fs.readFileSync(scopeFileName, "utf8"); - if (!SVELTE_VERSION.startsWith("5") || isSvelte5Only) { + if (!svelteVersion.gte(5) || isSvelte5Only) { return scopeFile; } @@ -140,7 +140,7 @@ function writeScopeFile( /input\.svelte(?:\.[jt]s)?$/u, "scope-output.json", ); - if (!SVELTE_VERSION.startsWith("5")) { + if (!svelteVersion.gte(5)) { // v4 if (isSvelte5Only) return; fs.writeFileSync(scopeFileName, json, "utf8"); @@ -204,7 +204,7 @@ function* listupFixturesImpl(dir: string): Iterable<{ const inputFileName = path.join(dir, filename); const isSvelte5Only = inputFileName.includes("/svelte5/"); - if (isSvelte5Only && !SVELTE_VERSION.startsWith("5")) { + if (isSvelte5Only && !svelteVersion.gte(5)) { continue; } From da6ce380001c33fc68135ac3996ee2754ec0f59c Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Fri, 17 Nov 2023 14:21:37 +0900 Subject: [PATCH 09/15] fix --- package.json | 4 +- .../example01-input.svelte | 24 - .../example01-no-unused-vars-result.json | 14 - .../example01-output.json | 4485 ---------- .../example01-scope-output.json | 6791 --------------- .../docs/functions/01-untrack-input.svelte | 12 - .../docs/functions/01-untrack-output.json | 1779 ---- .../01-untrack-prefer-const-result.json | 14 - .../functions/01-untrack-scope-output.json | 1537 ---- .../docs/old-vs-new/01-counter-input.svelte | 14 - .../docs/old-vs-new/01-counter-output.json | 2336 ----- .../01-counter-prefer-const-result.json | 8 - .../old-vs-new/01-counter-scope-output.json | 1372 --- .../02-tracking-dependencies-input.svelte | 13 - .../02-tracking-dependencies-output.json | 3189 ------- ...king-dependencies-prefer-const-result.json | 8 - ...02-tracking-dependencies-scope-output.json | 1960 ----- .../03-untracking-dependencies-input.svelte | 15 - .../03-untracking-dependencies-output.json | 3574 -------- ...king-dependencies-prefer-const-result.json | 8 - ...-untracking-dependencies-scope-output.json | 2291 ----- .../04-simple-component-props-input.svelte | 5 - .../04-simple-component-props-output.json | 732 -- ...e-component-props-prefer-const-result.json | 8 - ...4-simple-component-props-scope-output.json | 585 -- .../05-advanced-component-props-input.svelte | 7 - .../05-advanced-component-props-output.json | 1387 --- ...d-component-props-prefer-const-result.json | 14 - ...advanced-component-props-requirements.json | 5 - ...advanced-component-props-scope-output.json | 947 --- .../old-vs-new/06-autoscroll-input.svelte | 48 - .../06-autoscroll-no-undef-result.json | 20 - ...toscroll-no-unused-expressions-result.json | 8 - .../docs/old-vs-new/06-autoscroll-output.json | 7513 ----------------- .../06-autoscroll-prefer-const-result.json | 8 - .../06-autoscroll-scope-output.json | 6265 -------------- .../docs/runes/01-$state-input.svelte | 7 - .../docs/runes/01-$state-output.json | 1224 --- .../docs/runes/01-$state-scope-output.json | 561 -- .../docs/runes/02-$derived-input.svelte | 10 - .../docs/runes/02-$derived-output.json | 2040 ----- .../02-$derived-prefer-const-result.json | 8 - .../docs/runes/02-$derived-scope-output.json | 1127 --- .../docs/runes/03-$effect-input.svelte | 24 - .../docs/runes/03-$effect-output.json | 3251 ------- .../runes/03-$effect-prefer-const-result.json | 8 - .../docs/runes/03-$effect-scope-output.json | 1664 ---- .../docs/runes/04-$effect-pre-input.svelte | 28 - ...fect-pre-no-unused-expressions-result.json | 8 - .../docs/runes/04-$effect-pre-output.json | 3771 --------- .../04-$effect-pre-prefer-const-result.json | 8 - .../runes/04-$effect-pre-scope-output.json | 2152 ----- .../docs/runes/05-$props-input.svelte | 3 - .../05-$props-no-unused-vars-result.json | 14 - .../docs/runes/05-$props-output.json | 699 -- .../runes/05-$props-prefer-const-result.json | 14 - .../docs/runes/05-$props-scope-output.json | 913 -- .../docs/runes/06-$props-input.svelte | 3 - .../06-$props-no-unused-vars-result.json | 8 - .../docs/runes/06-$props-output.json | 570 -- .../runes/06-$props-prefer-const-result.json | 8 - .../docs/runes/06-$props-requirements.json | 5 - .../docs/runes/06-$props-scope-output.json | 389 - .../docs/runes/07-$props-input.svelte | 3 - .../07-$props-no-unused-vars-result.json | 26 - .../docs/runes/07-$props-output.json | 809 -- .../runes/07-$props-prefer-const-result.json | 26 - .../docs/runes/07-$props-scope-output.json | 1759 ---- .../docs/runes/08-$props-ts-input.svelte | 4 - .../08-$props-ts-no-unused-vars-result.json | 26 - .../docs/runes/08-$props-ts-output.json | 1208 --- .../08-$props-ts-prefer-const-result.json | 26 - .../docs/runes/08-$props-ts-requirements.json | 8 - .../docs/runes/08-$props-ts-scope-output.json | 2160 ----- .../docs/runes/09-how-to-opt-in-input.svelte | 2 - .../docs/runes/09-how-to-opt-in-output.json | 390 - .../runes/09-how-to-opt-in-scope-output.json | 58 - .../docs/universal-reactivity/01-input.svelte | 11 - .../docs/universal-reactivity/01-output.json | 1421 ---- .../universal-reactivity/01-scope-output.json | 826 -- .../docs/universal-reactivity/02-input.svelte | 20 - .../docs/universal-reactivity/02-output.json | 2411 ------ .../universal-reactivity/02-scope-output.json | 1918 ----- .../universal-reactivity/03-input.svelte.js | 14 - .../docs/universal-reactivity/03-output.json | 1270 --- .../universal-reactivity/03-scope-output.json | 1458 ---- .../03-ts-input.svelte.ts | 14 - .../universal-reactivity/03-ts-output.json | 1271 --- .../03-ts-scope-output.json | 1458 ---- .../03-ts-type-output.svelte.ts | 14 - .../optin-runes01-input.svelte | 12 - .../optin-runes01-output.json | 2371 ------ .../optin-runes01-prefer-const-result.json | 8 - .../optin-runes01-scope-output.json | 1127 --- .../universal-reactivity/03-scope-output.json | 351 +- .../03-ts-scope-output.json | 351 +- 96 files changed, 560 insertions(+), 87788 deletions(-) delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json delete mode 100644 tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json diff --git a/package.json b/package.json index 08abe35a..c15536a4 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "release": "changeset publish", "test": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", "ts": "node -r esbuild-register", - "update-fixtures": "pnpm i -D svelte@4 && pnpm run run-update-fixtures && git checkout package.json && pnpm i && pnpm run run-update-fixtures", + "update-fixtures": "git add package.json && pnpm i -D svelte@4 && git checkout package.json && pnpm run run-update-fixtures && pnpm i && pnpm run run-update-fixtures", "run-update-fixtures": "pnpm run ts ./tools/update-fixtures.ts", "version:ci": "env-cmd -e version-ci pnpm run build:meta && changeset version" }, @@ -104,7 +104,7 @@ "prettier-plugin-svelte": "^3.0.0", "rimraf": "^5.0.1", "semver": "^7.5.1", - "svelte": "^4.2.4", + "svelte": "^5.0.0-next.2", "svelte2tsx": "^0.6.25", "typescript": "~5.1.3", "typescript-eslint-parser-for-extra-files": "^0.5.0" diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-input.svelte deleted file mode 100644 index 4abc1593..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-input.svelte +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json deleted file mode 100644 index 8ea9fbdb..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-no-unused-vars-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "no-unused-vars", - "code": "remaining", - "line": 4, - "column": 11 - }, - { - "ruleId": "no-unused-vars", - "code": "addTodo", - "line": 9, - "column": 11 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json deleted file mode 100644 index e4e9983f..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-output.json +++ /dev/null @@ -1,4485 +0,0 @@ -{ - "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": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrayExpression", - "elements": [], - "range": [ - 29, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "range": [ - 14, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - ], - "range": [ - 10, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "'recalculating'", - "value": "recalculating", - "range": [ - 78, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 29 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "log", - "range": [ - 74, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "range": [ - 66, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "optional": false, - "range": [ - 66, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 30 - } - } - }, - "range": [ - 66, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UnaryExpression", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "todo", - "range": [ - 127, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 35 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "done", - "range": [ - 132, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 36 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "range": [ - 127, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 126, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - ], - "range": [ - 118, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 40 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "todos", - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "filter", - "range": [ - 111, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - "range": [ - 105, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - "optional": false, - "range": [ - 105, - 137 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 41 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "length", - "range": [ - 138, - 144 - ], - "loc": { - "start": { - "line": 6, - "column": 42 - }, - "end": { - "line": 6, - "column": 48 - } - } - }, - "range": [ - 105, - 144 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 48 - } - } - }, - "range": [ - 98, - 145 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 49 - } - } - } - ], - "range": [ - 62, - 148 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "remaining", - "range": [ - 45, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - ], - "range": [ - 36, - 148 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "ReturnStatement", - "argument": null, - "range": [ - 206, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 36 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 183, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "key", - "range": [ - 189, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 183, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "operator": "!==", - "right": { - "type": "Literal", - "raw": "'Enter'", - "value": "Enter", - "range": [ - 197, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - "range": [ - 183, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - "range": [ - 179, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 36 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "false", - "value": false, - "range": [ - 235, - 240 - ], - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 228, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - "range": [ - 221, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 26 - } - } - } - ], - "range": [ - 217, - 242 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 263, - 268 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 269, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "range": [ - 263, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 276, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 33 - }, - "end": { - "line": 13, - "column": 38 - } - } - }, - "range": [ - 263, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 38 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 256, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 39 - } - } - }, - "range": [ - 249, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 39 - } - } - } - ], - "range": [ - 245, - 283 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 40 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "todos", - "range": [ - 287, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "operator": "=", - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "SpreadElement", - "argument": { - "type": "Identifier", - "name": "todos", - "range": [ - 299, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "range": [ - 296, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "done", - "range": [ - 315, - 319 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "done", - "range": [ - 331, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "range": [ - 324, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 27 - } - } - } - ], - "range": [ - 322, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 319, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 11 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - "range": [ - 311, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - { - "type": "Property", - "kind": "set", - "computed": false, - "key": { - "type": "Identifier", - "name": "done", - "range": [ - 346, - 350 - ], - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 367, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - } - ], - "range": [ - 358, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - } - ], - "range": [ - 350, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "range": [ - 342, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "text", - "range": [ - 383, - 387 - ], - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "text", - "range": [ - 399, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "range": [ - 392, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 27 - } - } - } - ], - "range": [ - 390, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 387, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "range": [ - 379, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - { - "type": "Property", - "kind": "set", - "computed": false, - "key": { - "type": "Identifier", - "name": "text", - "range": [ - 414, - 418 - ], - "loc": { - "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 435, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - } - ], - "range": [ - 426, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - ], - "range": [ - 418, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "range": [ - 410, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 35 - } - } - } - ], - "range": [ - 306, - 446 - ], - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 20, - "column": 3 - } - } - } - ], - "range": [ - 295, - 447 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "range": [ - 287, - 447 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "range": [ - 287, - 448 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 20, - "column": 5 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 452, - 457 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 458, - 464 - ], - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "range": [ - 452, - 464 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 465, - 470 - ], - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - "range": [ - 452, - 470 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - "operator": "=", - "right": { - "type": "Literal", - "raw": "''", - "value": "", - "range": [ - 473, - 475 - ], - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - "range": [ - 452, - 475 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - "range": [ - 452, - 476 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 26 - } - } - } - ], - "range": [ - 175, - 479 - ], - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 23, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "addTodo", - "range": [ - 160, - 167 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - ], - "range": [ - 151, - 479 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 23, - "column": 2 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 480, - 489 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - "range": [ - 0, - 489 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 24, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "todos", - "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": "Punctuator", - "value": "[", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 36, - 44 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "remaining", - "range": [ - 45, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "log", - "range": [ - 74, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 77, - 78 - ], - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - { - "type": "String", - "value": "'recalculating'", - "range": [ - 78, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 93, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 5, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 98, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "todos", - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "filter", - "range": [ - 111, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 117, - 118 - ], - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 123, - 125 - ], - "loc": { - "start": { - "line": 6, - "column": 27 - }, - "end": { - "line": 6, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "!", - "range": [ - 126, - 127 - ], - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 31 - } - } - }, - { - "type": "Identifier", - "value": "todo", - "range": [ - 127, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 131, - 132 - ], - "loc": { - "start": { - "line": 6, - "column": 35 - }, - "end": { - "line": 6, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "done", - "range": [ - 132, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 36 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 6, - "column": 40 - }, - "end": { - "line": 6, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 137, - 138 - ], - "loc": { - "start": { - "line": 6, - "column": 41 - }, - "end": { - "line": 6, - "column": 42 - } - } - }, - { - "type": "Identifier", - "value": "length", - "range": [ - 138, - 144 - ], - "loc": { - "start": { - "line": 6, - "column": 42 - }, - "end": { - "line": 6, - "column": 48 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 144, - 145 - ], - "loc": { - "start": { - "line": 6, - "column": 48 - }, - "end": { - "line": 6, - "column": 49 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 147, - 148 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 151, - 159 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "addTodo", - "range": [ - 160, - 167 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 173, - 174 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 175, - 176 - ], - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 9, - "column": 26 - } - } - }, - { - "type": "Keyword", - "value": "if", - "range": [ - 179, - 181 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 182, - 183 - ], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 183, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 188, - 189 - ], - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "key", - "range": [ - 189, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "!==", - "range": [ - 193, - 196 - ], - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - { - "type": "String", - "value": "'Enter'", - "range": [ - 197, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 10, - "column": 27 - }, - "end": { - "line": 10, - "column": 28 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 206, - 212 - ], - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 212, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 35 - }, - "end": { - "line": 10, - "column": 36 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 217, - 220 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 226, - 227 - ], - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 234, - 235 - ], - "loc": { - "start": { - "line": 12, - "column": 19 - }, - "end": { - "line": 12, - "column": 20 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 235, - 240 - ], - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 240, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 25 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 241, - 242 - ], - "loc": { - "start": { - "line": 12, - "column": 26 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 245, - 248 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 254, - 255 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 262, - 263 - ], - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 13, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 263, - 268 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 268, - 269 - ], - "loc": { - "start": { - "line": 13, - "column": 25 - }, - "end": { - "line": 13, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "target", - "range": [ - 269, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 275, - 276 - ], - "loc": { - "start": { - "line": 13, - "column": 32 - }, - "end": { - "line": 13, - "column": 33 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 276, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 33 - }, - "end": { - "line": 13, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 38 - }, - "end": { - "line": 13, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 282, - 283 - ], - "loc": { - "start": { - "line": 13, - "column": 39 - }, - "end": { - "line": 13, - "column": 40 - } - } - }, - { - "type": "Identifier", - "value": "todos", - "range": [ - 287, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 293, - 294 - ], - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 295, - 296 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 296, - 299 - ], - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "todos", - "range": [ - 299, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 304, - 305 - ], - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 306, - 307 - ], - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 15, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 311, - 314 - ], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "done", - "range": [ - 315, - 319 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 319, - 320 - ], - "loc": { - "start": { - "line": 16, - "column": 11 - }, - "end": { - "line": 16, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 320, - 321 - ], - "loc": { - "start": { - "line": 16, - "column": 12 - }, - "end": { - "line": 16, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 322, - 323 - ], - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 324, - 330 - ], - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "done", - "range": [ - 331, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 336, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 28 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 337, - 338 - ], - "loc": { - "start": { - "line": 16, - "column": 29 - }, - "end": { - "line": 16, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "set", - "range": [ - 342, - 345 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "done", - "range": [ - 346, - 350 - ], - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 350, - 351 - ], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 356, - 357 - ], - "loc": { - "start": { - "line": 17, - "column": 17 - }, - "end": { - "line": 17, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 358, - 359 - ], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 365, - 366 - ], - "loc": { - "start": { - "line": 17, - "column": 26 - }, - "end": { - "line": 17, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 367, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 373, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 34 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 374, - 375 - ], - "loc": { - "start": { - "line": 17, - "column": 35 - }, - "end": { - "line": 17, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 379, - 382 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 383, - 387 - ], - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 387, - 388 - ], - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 388, - 389 - ], - "loc": { - "start": { - "line": 18, - "column": 12 - }, - "end": { - "line": 18, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 390, - 391 - ], - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 392, - 398 - ], - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 399, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 404, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 405, - 406 - ], - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "set", - "range": [ - 410, - 413 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 414, - 418 - ], - "loc": { - "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 418, - 419 - ], - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 19, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 424, - 425 - ], - "loc": { - "start": { - "line": 19, - "column": 17 - }, - "end": { - "line": 19, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 426, - 427 - ], - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 433, - 434 - ], - "loc": { - "start": { - "line": 19, - "column": 26 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 435, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 441, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 34 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 445, - 446 - ], - "loc": { - "start": { - "line": 20, - "column": 2 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 446, - 447 - ], - "loc": { - "start": { - "line": 20, - "column": 3 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 447, - 448 - ], - "loc": { - "start": { - "line": 20, - "column": 4 - }, - "end": { - "line": 20, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 452, - 457 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 457, - 458 - ], - "loc": { - "start": { - "line": 22, - "column": 7 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "target", - "range": [ - 458, - 464 - ], - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 464, - 465 - ], - "loc": { - "start": { - "line": 22, - "column": 14 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 465, - 470 - ], - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 471, - 472 - ], - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - { - "type": "String", - "value": "''", - "range": [ - 473, - 475 - ], - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 475, - 476 - ], - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 478, - 479 - ], - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 480, - 481 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 481, - 482 - ], - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 482, - 488 - ], - "loc": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 24, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 488, - 489 - ], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - } - } - } - ], - "range": [ - 0, - 490 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 25, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json deleted file mode 100644 index 7dd00c92..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/fine-grained-reactivity/example01-scope-output.json +++ /dev/null @@ -1,6791 +0,0 @@ -{ - "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": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "todos", - "identifiers": [ - { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrayExpression", - "elements": [], - "range": [ - 29, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "range": [ - 14, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 287, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 299, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "name": "remaining", - "identifiers": [ - { - "type": "Identifier", - "name": "remaining", - "range": [ - 45, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "remaining", - "range": [ - 45, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "'recalculating'", - "value": "recalculating", - "range": [ - 78, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 29 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "log", - "range": [ - 74, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "range": [ - 66, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "optional": false, - "range": [ - 66, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 30 - } - } - }, - "range": [ - 66, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UnaryExpression", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "todo", - "range": [ - 127, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 35 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "done", - "range": [ - 132, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 36 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "range": [ - 127, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 126, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - ], - "range": [ - 118, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 40 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "todos", - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "filter", - "range": [ - 111, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - "range": [ - 105, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - "optional": false, - "range": [ - 105, - 137 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 41 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "length", - "range": [ - 138, - 144 - ], - "loc": { - "start": { - "line": 6, - "column": 42 - }, - "end": { - "line": 6, - "column": 48 - } - } - }, - "range": [ - 105, - 144 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 48 - } - } - }, - "range": [ - 98, - 145 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 49 - } - } - } - ], - "range": [ - 62, - 148 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "remaining", - "range": [ - 45, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - ], - "range": [ - 36, - 148 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - } - } - ], - "references": [] - }, - { - "name": "addTodo", - "identifiers": [ - { - "type": "Identifier", - "name": "addTodo", - "range": [ - 160, - 167 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 17 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "addTodo", - "range": [ - 160, - 167 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "ReturnStatement", - "argument": null, - "range": [ - 206, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 36 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 183, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "key", - "range": [ - 189, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 183, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "operator": "!==", - "right": { - "type": "Literal", - "raw": "'Enter'", - "value": "Enter", - "range": [ - 197, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - "range": [ - 183, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - "range": [ - 179, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 36 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "false", - "value": false, - "range": [ - 235, - 240 - ], - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 228, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - "range": [ - 221, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 26 - } - } - } - ], - "range": [ - 217, - 242 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 263, - 268 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 269, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "range": [ - 263, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 276, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 33 - }, - "end": { - "line": 13, - "column": 38 - } - } - }, - "range": [ - 263, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 38 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 256, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 39 - } - } - }, - "range": [ - 249, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 39 - } - } - } - ], - "range": [ - 245, - 283 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 40 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "todos", - "range": [ - 287, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "operator": "=", - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "SpreadElement", - "argument": { - "type": "Identifier", - "name": "todos", - "range": [ - 299, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "range": [ - 296, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "done", - "range": [ - 315, - 319 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "done", - "range": [ - 331, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "range": [ - 324, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 27 - } - } - } - ], - "range": [ - 322, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 319, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 11 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - "range": [ - 311, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - { - "type": "Property", - "kind": "set", - "computed": false, - "key": { - "type": "Identifier", - "name": "done", - "range": [ - 346, - 350 - ], - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 367, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - } - ], - "range": [ - 358, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - } - ], - "range": [ - 350, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "range": [ - 342, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "text", - "range": [ - 383, - 387 - ], - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "text", - "range": [ - 399, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "range": [ - 392, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 27 - } - } - } - ], - "range": [ - 390, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 387, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "range": [ - 379, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - { - "type": "Property", - "kind": "set", - "computed": false, - "key": { - "type": "Identifier", - "name": "text", - "range": [ - 414, - 418 - ], - "loc": { - "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 435, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - } - ], - "range": [ - 426, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - ], - "range": [ - 418, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "range": [ - 410, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 35 - } - } - } - ], - "range": [ - 306, - 446 - ], - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 20, - "column": 3 - } - } - } - ], - "range": [ - 295, - 447 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "range": [ - 287, - 447 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "range": [ - 287, - 448 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 20, - "column": 5 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 452, - 457 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 458, - 464 - ], - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "range": [ - 452, - 464 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 465, - 470 - ], - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - "range": [ - 452, - 470 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - "operator": "=", - "right": { - "type": "Literal", - "raw": "''", - "value": "", - "range": [ - 473, - 475 - ], - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - "range": [ - 452, - 475 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - "range": [ - 452, - 476 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 26 - } - } - } - ], - "range": [ - 175, - 479 - ], - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 23, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "addTodo", - "range": [ - 160, - 167 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - ], - "range": [ - 151, - 479 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 23, - "column": 2 - } - } - } - } - ], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "todos", - "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 - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "todos", - "identifiers": [ - { - "type": "Identifier", - "name": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "'recalculating'", - "value": "recalculating", - "range": [ - 78, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 29 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "log", - "range": [ - 74, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "range": [ - 66, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "optional": false, - "range": [ - 66, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 30 - } - } - }, - "range": [ - 66, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UnaryExpression", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "todo", - "range": [ - 127, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 35 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "done", - "range": [ - 132, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 36 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "range": [ - 127, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 126, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - ], - "range": [ - 118, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 40 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "todos", - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "filter", - "range": [ - 111, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - "range": [ - 105, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - "optional": false, - "range": [ - 105, - 137 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 41 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "length", - "range": [ - 138, - 144 - ], - "loc": { - "start": { - "line": 6, - "column": 42 - }, - "end": { - "line": 6, - "column": 48 - } - } - }, - "range": [ - 105, - 144 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 48 - } - } - }, - "range": [ - 98, - 145 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 49 - } - } - } - ], - "range": [ - 62, - 148 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "remaining", - "range": [ - 45, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - ], - "range": [ - 36, - 148 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "todo", - "identifiers": [ - { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - }, - "node": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UnaryExpression", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "todo", - "range": [ - 127, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 35 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "done", - "range": [ - 132, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 36 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "range": [ - 127, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 126, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 30 - }, - "end": { - "line": 6, - "column": 40 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - ], - "range": [ - 118, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 40 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "todo", - "range": [ - 127, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 35 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "todo", - "range": [ - 127, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 35 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "todo", - "range": [ - 118, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - } - ], - "childScopes": [], - "through": [] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "event", - "identifiers": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "ReturnStatement", - "argument": null, - "range": [ - 206, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 36 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 183, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "key", - "range": [ - 189, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 183, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "operator": "!==", - "right": { - "type": "Literal", - "raw": "'Enter'", - "value": "Enter", - "range": [ - 197, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - "range": [ - 183, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - "range": [ - 179, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 36 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "false", - "value": false, - "range": [ - 235, - 240 - ], - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 228, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - "range": [ - 221, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 26 - } - } - } - ], - "range": [ - 217, - 242 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 263, - 268 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 269, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "range": [ - 263, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 276, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 33 - }, - "end": { - "line": 13, - "column": 38 - } - } - }, - "range": [ - 263, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 38 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 256, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 39 - } - } - }, - "range": [ - 249, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 39 - } - } - } - ], - "range": [ - 245, - 283 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 40 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "todos", - "range": [ - 287, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "operator": "=", - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "SpreadElement", - "argument": { - "type": "Identifier", - "name": "todos", - "range": [ - 299, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "range": [ - 296, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "done", - "range": [ - 315, - 319 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "done", - "range": [ - 331, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "range": [ - 324, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 16 - }, - "end": { - "line": 16, - "column": 27 - } - } - } - ], - "range": [ - 322, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 319, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 11 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - "range": [ - 311, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - { - "type": "Property", - "kind": "set", - "computed": false, - "key": { - "type": "Identifier", - "name": "done", - "range": [ - 346, - 350 - ], - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 367, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - } - ], - "range": [ - 358, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - } - ], - "range": [ - 350, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "range": [ - 342, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "text", - "range": [ - 383, - 387 - ], - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "text", - "range": [ - 399, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "range": [ - 392, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 27 - } - } - } - ], - "range": [ - 390, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 387, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - "range": [ - 379, - 405 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 29 - } - } - }, - { - "type": "Property", - "kind": "set", - "computed": false, - "key": { - "type": "Identifier", - "name": "text", - "range": [ - 414, - 418 - ], - "loc": { - "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 435, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - } - ], - "range": [ - 426, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - ], - "range": [ - 418, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "range": [ - 410, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 35 - } - } - } - ], - "range": [ - 306, - 446 - ], - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 20, - "column": 3 - } - } - } - ], - "range": [ - 295, - 447 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "range": [ - 287, - 447 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 20, - "column": 4 - } - } - }, - "range": [ - 287, - 448 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 20, - "column": 5 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 452, - 457 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 458, - 464 - ], - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "range": [ - 452, - 464 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 465, - 470 - ], - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - "range": [ - 452, - 470 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - "operator": "=", - "right": { - "type": "Literal", - "raw": "''", - "value": "", - "range": [ - 473, - 475 - ], - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - "range": [ - 452, - 475 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - "range": [ - 452, - 476 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 26 - } - } - } - ], - "range": [ - 175, - 479 - ], - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 23, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "addTodo", - "range": [ - 160, - 167 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - ], - "range": [ - 151, - 479 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 23, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 183, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 263, - 268 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 452, - 457 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - } - ] - }, - { - "name": "done", - "identifiers": [ - { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "false", - "value": false, - "range": [ - 235, - 240 - ], - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 228, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - "range": [ - 221, - 241 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 26 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 331, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - } - ] - }, - { - "name": "text", - "identifiers": [ - { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 263, - 268 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 269, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "range": [ - 263, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 276, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 33 - }, - "end": { - "line": 13, - "column": 38 - } - } - }, - "range": [ - 263, - 281 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 38 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 256, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 39 - } - } - }, - "range": [ - 249, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 39 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 399, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 183, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 263, - 268 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 287, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 299, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 452, - 457 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 168, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 331, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 331, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "value", - "identifiers": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, - "node": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 367, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "range": [ - 360, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 33 - } - } - } - ], - "range": [ - 358, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 19 - }, - "end": { - "line": 17, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - } - ], - "range": [ - 350, - 374 - ], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 35 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "value", - "range": [ - 367, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "value", - "range": [ - 367, - 372 - ], - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "value", - "range": [ - 351, - 356 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 17 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "done", - "range": [ - 360, - 364 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "done", - "range": [ - 221, - 225 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 399, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 399, - 403 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "value", - "identifiers": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - "node": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "operator": "=", - "right": { - "type": "Identifier", - "name": "value", - "range": [ - 435, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "range": [ - 428, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 33 - } - } - } - ], - "range": [ - 426, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - ], - "range": [ - 418, - 442 - ], - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 19, - "column": 35 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "value", - "range": [ - 435, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "value", - "range": [ - 435, - 440 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 33 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "value", - "range": [ - 419, - 424 - ], - "loc": { - "start": { - "line": 19, - "column": 12 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 428, - 432 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 249, - 253 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 287, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "todos", - "range": [ - 299, - 304 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "todos", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 228, - 234 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 256, - 262 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte deleted file mode 100644 index 640616dc..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-input.svelte +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json deleted file mode 100644 index b4fd89ac..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-output.json +++ /dev/null @@ -1,1779 +0,0 @@ -{ - "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": "ImportDeclaration", - "source": { - "type": "Literal", - "raw": "'svelte'", - "value": "svelte", - "range": [ - 34, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - "specifiers": [ - { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "local": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - ], - "range": [ - 10, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - ], - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 61, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - "range": [ - 50, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - ], - "range": [ - 46, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "console", - "range": [ - 158, - 165 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "log", - "range": [ - 166, - 169 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - "range": [ - 158, - 169 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - "optional": false, - "range": [ - 158, - 172 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - "range": [ - 158, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "Identifier", - "name": "b", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 196, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 22 - }, - "end": { - "line": 10, - "column": 29 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "untrack", - "range": [ - 188, - 195 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 21 - } - } - }, - "optional": false, - "range": [ - 188, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 30 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "console", - "range": [ - 176, - 183 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "log", - "range": [ - 184, - 187 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 13 - } - } - }, - "range": [ - 176, - 187 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 13 - } - } - }, - "optional": false, - "range": [ - 176, - 205 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - "range": [ - 176, - 206 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 32 - } - } - } - ], - "range": [ - 87, - 209 - ], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 11, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 81, - 209 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 11, - "column": 2 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$effect", - "range": [ - 73, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "optional": false, - "range": [ - 73, - 210 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "range": [ - 73, - 211 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 11, - "column": 4 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 212, - 221 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 9 - } - } - }, - "range": [ - 0, - 221 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [ - { - "type": "Line", - "value": " this will run when `a` changes,", - "range": [ - 91, - 125 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 36 - } - } - }, - { - "type": "Line", - "value": " but not when `b` changes", - "range": [ - 128, - 155 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 29 - } - } - } - ], - "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": "import", - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "from", - "range": [ - 29, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "String", - "value": "'svelte'", - "range": [ - 34, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 46, - 49 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 67, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "$effect", - "range": [ - 73, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 82, - 83 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 84, - 86 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 87, - 88 - ], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "console", - "range": [ - 158, - 165 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 165, - 166 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "log", - "range": [ - 166, - 169 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 169, - 170 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 171, - 172 - ], - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 172, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "console", - "range": [ - 176, - 183 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 183, - 184 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "log", - "range": [ - 184, - 187 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 187, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "untrack", - "range": [ - 188, - 195 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 195, - 196 - ], - "loc": { - "start": { - "line": 10, - "column": 21 - }, - "end": { - "line": 10, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 196, - 197 - ], - "loc": { - "start": { - "line": 10, - "column": 22 - }, - "end": { - "line": 10, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 197, - 198 - ], - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 199, - 201 - ], - "loc": { - "start": { - "line": 10, - "column": 25 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 203, - 204 - ], - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 10, - "column": 30 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 205, - 206 - ], - "loc": { - "start": { - "line": 10, - "column": 31 - }, - "end": { - "line": 10, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 208, - 209 - ], - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 11, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 209, - 210 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 210, - 211 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 212, - 213 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 213, - 214 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 214, - 220 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 220, - 221 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 9 - } - } - } - ], - "range": [ - 0, - 222 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json deleted file mode 100644 index d77a6435..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-prefer-const-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "a", - "line": 4, - "column": 8 - }, - { - "ruleId": "prefer-const", - "code": "b", - "line": 4, - "column": 11 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json deleted file mode 100644 index 7b0c1e2a..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/functions/01-untrack-scope-output.json +++ /dev/null @@ -1,1537 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$$slots", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$props", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$restProps", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 73, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "untrack", - "identifiers": [ - { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - ], - "defs": [ - { - "type": "ImportBinding", - "name": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "node": { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "local": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "untrack", - "range": [ - 188, - 195 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 21 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - } - ] - }, - { - "name": "a", - "identifiers": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - ], - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 61, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - "range": [ - 50, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ] - }, - { - "name": "b", - "identifiers": [ - { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - ], - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 61, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - "range": [ - 50, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 73, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 158, - 165 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 176, - 183 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "untrack", - "range": [ - 188, - 195 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 21 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 158, - 165 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 176, - 183 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "untrack", - "range": [ - 188, - 195 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 21 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 73, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 158, - 165 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 176, - 183 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 158, - 165 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 176, - 183 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte deleted file mode 100644 index 95b24f75..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-input.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json deleted file mode 100644 index 27c7282c..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-output.json +++ /dev/null @@ -1,2336 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteScriptElement", - "name": { - "type": "SvelteName", - "name": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "range": [ - 15, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 22 - } - } - } - ], - "range": [ - 11, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 57, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 31 - }, - "end": { - "line": 4, - "column": 32 - } - } - }, - "range": [ - 57, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 48, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - "range": [ - 39, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 33 - } - } - } - ], - "range": [ - 35, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "'Too high!'", - "value": "Too high!", - "range": [ - 115, - 126 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 20 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "alert", - "range": [ - 109, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "optional": false, - "range": [ - 109, - 127 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - "range": [ - 109, - 128 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 22 - } - } - } - ], - "range": [ - 104, - 132 - ], - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 8, - "column": 3 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 92, - 97 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - "operator": ">", - "right": { - "type": "Literal", - "raw": "10", - "value": 10, - "range": [ - 100, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "range": [ - 92, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "range": [ - 88, - 132 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 8, - "column": 3 - } - } - } - ], - "range": [ - 84, - 135 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 9, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 78, - 135 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 9, - "column": 2 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "optional": false, - "range": [ - 70, - 136 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 9, - "column": 3 - } - } - }, - "range": [ - 70, - 137 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 9, - "column": 4 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 138, - 147 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "range": [ - 0, - 147 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 147, - 149 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 12, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 150, - 156 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 160, - 165 - ], - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 157, - 165 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 173, - 178 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 173, - 180 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 31 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 167, - 180 - ], - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 31 - } - } - }, - "range": [ - 157, - 181 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 32 - } - } - } - ], - "selfClosing": false, - "range": [ - 149, - 182 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 33 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 182, - 184 - ], - "loc": { - "start": { - "line": 12, - "column": 33 - }, - "end": { - "line": 13, - "column": 1 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "count", - "range": [ - 185, - 190 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - "range": [ - 184, - 191 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 8 - } - } - }, - { - "type": "SvelteText", - "value": " / ", - "range": [ - 191, - 194 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "double", - "range": [ - 195, - 201 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 18 - } - } - }, - "range": [ - 194, - 202 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 14, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 203, - 212 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 9 - } - } - }, - "range": [ - 149, - 212 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 14, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 35, - 38 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "$derived", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 57, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 30 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 31 - }, - "end": { - "line": 4, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 32 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 67, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 33 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 77, - 78 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 81, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 84, - 85 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "if", - "range": [ - 88, - 90 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 91, - 92 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 92, - 97 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 100, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 104, - 105 - ], - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "alert", - "range": [ - 109, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 114, - 115 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "String", - "value": "'Too high!'", - "range": [ - 115, - 126 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 126, - 127 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 127, - 128 - ], - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 131, - 132 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 134, - 135 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 135, - 136 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 9, - "column": 3 - }, - "end": { - "line": 9, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 138, - 139 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 139, - 140 - ], - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 140, - 146 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 146, - 147 - ], - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 147, - 149 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 12, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 149, - 150 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 150, - 156 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 157, - 159 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 160, - 165 - ], - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 165, - 166 - ], - "loc": { - "start": { - "line": 12, - "column": 16 - }, - "end": { - "line": 12, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 166, - 167 - ], - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 168, - 169 - ], - "loc": { - "start": { - "line": 12, - "column": 19 - }, - "end": { - "line": 12, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 170, - 172 - ], - "loc": { - "start": { - "line": 12, - "column": 21 - }, - "end": { - "line": 12, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 173, - 178 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 178, - 180 - ], - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 180, - 181 - ], - "loc": { - "start": { - "line": 12, - "column": 31 - }, - "end": { - "line": 12, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 181, - 182 - ], - "loc": { - "start": { - "line": 12, - "column": 32 - }, - "end": { - "line": 12, - "column": 33 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 182, - 184 - ], - "loc": { - "start": { - "line": 12, - "column": 33 - }, - "end": { - "line": 13, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 184, - 185 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 185, - 190 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 190, - 191 - ], - "loc": { - "start": { - "line": 13, - "column": 7 - }, - "end": { - "line": 13, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 191, - 192 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "/", - "range": [ - 192, - 193 - ], - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 193, - 194 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 194, - 195 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 195, - 201 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 14, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 203, - 204 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 205, - 211 - ], - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 14, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 211, - 212 - ], - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 9 - } - } - } - ], - "range": [ - 0, - 213 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 15, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json deleted file mode 100644 index 9e7cd050..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "double", - "line": 4, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json deleted file mode 100644 index cf2097bb..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/01-counter-scope-output.json +++ /dev/null @@ -1,1372 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$$slots", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$props", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$restProps", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "range": [ - 15, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 57, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 92, - 97 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 173, - 178 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 185, - 190 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - } - ] - }, - { - "name": "double", - "identifiers": [ - { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 57, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 31 - }, - "end": { - "line": 4, - "column": 32 - } - } - }, - "range": [ - 57, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 48, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - "range": [ - 39, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 33 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 195, - 201 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 18 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 57, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 185, - 190 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 195, - 201 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 18 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 92, - 97 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - } - ], - "childScopes": [ - { - "type": "block", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "alert", - "range": [ - 109, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": null - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "alert", - "range": [ - 109, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 92, - 97 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "alert", - "range": [ - 109, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": null - } - ] - }, - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 173, - 178 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 173, - 178 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "alert", - "range": [ - 109, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "alert", - "range": [ - 109, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": null - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte deleted file mode 100644 index 21de10ae..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-input.svelte +++ /dev/null @@ -1,13 +0,0 @@ - - - - -

{a} + {b} = {sum}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json deleted file mode 100644 index d6cffa0d..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-output.json +++ /dev/null @@ -1,3189 +0,0 @@ -{ - "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": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "range": [ - 14, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 18 - } - } - } - ], - "range": [ - 10, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 38, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - "range": [ - 34, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 18 - } - } - } - ], - "range": [ - 30, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "add", - "range": [ - 69, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - "optional": false, - "range": [ - 69, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 60, - 75 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - "range": [ - 54, - 75 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 26 - } - } - } - ], - "range": [ - 50, - 76 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - "operator": "+", - "right": { - "type": "Identifier", - "name": "b", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - "range": [ - 98, - 111 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 15 - } - } - } - ], - "range": [ - 94, - 114 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 8, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "add", - "range": [ - 88, - 91 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "params": [], - "range": [ - 79, - 114 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 8, - "column": 2 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 115, - 124 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "range": [ - 0, - 124 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 124, - 126 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 11, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 127, - 133 - ], - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 11, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 134, - 142 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "a", - "range": [ - 150, - 151 - ], - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 25 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 150, - 153 - ], - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 27 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 144, - 153 - ], - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 27 - } - } - }, - "range": [ - 134, - 154 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 28 - } - } - } - ], - "selfClosing": false, - "range": [ - 126, - 155 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "a++", - "range": [ - 155, - 158 - ], - "loc": { - "start": { - "line": 11, - "column": 29 - }, - "end": { - "line": 11, - "column": 32 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 158, - 167 - ], - "loc": { - "start": { - "line": 11, - "column": 32 - }, - "end": { - "line": 11, - "column": 41 - } - } - }, - "range": [ - 126, - 167 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 41 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 41 - }, - "end": { - "line": 12, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 169, - 175 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 179, - 184 - ], - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 176, - 184 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 192, - 193 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 192, - 195 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 186, - 195 - ], - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - "range": [ - 176, - 196 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 28 - } - } - } - ], - "selfClosing": false, - "range": [ - 168, - 197 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "b++", - "range": [ - 197, - 200 - ], - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 32 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 200, - 209 - ], - "loc": { - "start": { - "line": 12, - "column": 32 - }, - "end": { - "line": 12, - "column": 41 - } - } - }, - "range": [ - 168, - 209 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 41 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 209, - 210 - ], - "loc": { - "start": { - "line": 12, - "column": 41 - }, - "end": { - "line": 13, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 211, - 212 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 210, - 213 - ], - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 3 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "a", - "range": [ - 214, - 215 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 5 - } - } - }, - "range": [ - 213, - 216 - ], - "loc": { - "start": { - "line": 13, - "column": 3 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - { - "type": "SvelteText", - "value": " + ", - "range": [ - 216, - 219 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 9 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "b", - "range": [ - 220, - 221 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - "range": [ - 219, - 222 - ], - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 12 - } - } - }, - { - "type": "SvelteText", - "value": " = ", - "range": [ - 222, - 225 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 15 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "sum", - "range": [ - 226, - 229 - ], - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "range": [ - 225, - 230 - ], - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 13, - "column": 20 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 230, - 234 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 24 - } - } - }, - "range": [ - 210, - 234 - ], - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 24 - } - } - } - ], - "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": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 30, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 50, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "$derived", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "add", - "range": [ - 69, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 75, - 76 - ], - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 79, - 87 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "add", - "range": [ - 88, - 91 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 91, - 92 - ], - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 92, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 98, - 104 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 107, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 113, - 114 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 115, - 116 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 116, - 117 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 117, - 123 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 124, - 126 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 11, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 126, - 127 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 127, - 133 - ], - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 11, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 134, - 136 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 11, - "column": 10 - }, - "end": { - "line": 11, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 142, - 143 - ], - "loc": { - "start": { - "line": 11, - "column": 16 - }, - "end": { - "line": 11, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 143, - 144 - ], - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 144, - 145 - ], - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 145, - 146 - ], - "loc": { - "start": { - "line": 11, - "column": 19 - }, - "end": { - "line": 11, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 147, - 149 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 150, - 151 - ], - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 151, - 153 - ], - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 153, - 154 - ], - "loc": { - "start": { - "line": 11, - "column": 27 - }, - "end": { - "line": 11, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 154, - 155 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - { - "type": "HTMLText", - "value": "a++", - "range": [ - 155, - 158 - ], - "loc": { - "start": { - "line": 11, - "column": 29 - }, - "end": { - "line": 11, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 158, - 159 - ], - "loc": { - "start": { - "line": 11, - "column": 32 - }, - "end": { - "line": 11, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 11, - "column": 33 - }, - "end": { - "line": 11, - "column": 34 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 160, - 166 - ], - "loc": { - "start": { - "line": 11, - "column": 34 - }, - "end": { - "line": 11, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 166, - 167 - ], - "loc": { - "start": { - "line": 11, - "column": 40 - }, - "end": { - "line": 11, - "column": 41 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 41 - }, - "end": { - "line": 12, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 168, - 169 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 169, - 175 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 176, - 178 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 178, - 179 - ], - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 179, - 184 - ], - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 184, - 185 - ], - "loc": { - "start": { - "line": 12, - "column": 16 - }, - "end": { - "line": 12, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 185, - 186 - ], - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 186, - 187 - ], - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 187, - 188 - ], - "loc": { - "start": { - "line": 12, - "column": 19 - }, - "end": { - "line": 12, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 189, - 191 - ], - "loc": { - "start": { - "line": 12, - "column": 21 - }, - "end": { - "line": 12, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 192, - 193 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 193, - 195 - ], - "loc": { - "start": { - "line": 12, - "column": 25 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 195, - 196 - ], - "loc": { - "start": { - "line": 12, - "column": 27 - }, - "end": { - "line": 12, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 196, - 197 - ], - "loc": { - "start": { - "line": 12, - "column": 28 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - { - "type": "HTMLText", - "value": "b++", - "range": [ - 197, - 200 - ], - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 200, - 201 - ], - "loc": { - "start": { - "line": 12, - "column": 32 - }, - "end": { - "line": 12, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 12, - "column": 33 - }, - "end": { - "line": 12, - "column": 34 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 202, - 208 - ], - "loc": { - "start": { - "line": 12, - "column": 34 - }, - "end": { - "line": 12, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 208, - 209 - ], - "loc": { - "start": { - "line": 12, - "column": 40 - }, - "end": { - "line": 12, - "column": 41 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 209, - 210 - ], - "loc": { - "start": { - "line": 12, - "column": 41 - }, - "end": { - "line": 13, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 210, - 211 - ], - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 211, - 212 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 212, - 213 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 213, - 214 - ], - "loc": { - "start": { - "line": 13, - "column": 3 - }, - "end": { - "line": 13, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 214, - 215 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 215, - 216 - ], - "loc": { - "start": { - "line": 13, - "column": 5 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 216, - 217 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - { - "type": "HTMLText", - "value": "+", - "range": [ - 217, - 218 - ], - "loc": { - "start": { - "line": 13, - "column": 7 - }, - "end": { - "line": 13, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 218, - 219 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 219, - 220 - ], - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 220, - 221 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 221, - 222 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 12 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 222, - 223 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 13 - } - } - }, - { - "type": "HTMLText", - "value": "=", - "range": [ - 223, - 224 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 14 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 224, - 225 - ], - "loc": { - "start": { - "line": 13, - "column": 14 - }, - "end": { - "line": 13, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 225, - 226 - ], - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "sum", - "range": [ - 226, - 229 - ], - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 229, - 230 - ], - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 13, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 230, - 231 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 231, - 232 - ], - "loc": { - "start": { - "line": 13, - "column": 21 - }, - "end": { - "line": 13, - "column": 22 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 232, - 233 - ], - "loc": { - "start": { - "line": 13, - "column": 22 - }, - "end": { - "line": 13, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 233, - 234 - ], - "loc": { - "start": { - "line": 13, - "column": 23 - }, - "end": { - "line": 13, - "column": 24 - } - } - } - ], - "range": [ - 0, - 235 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json deleted file mode 100644 index cc694836..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "sum", - "line": 4, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json deleted file mode 100644 index 9e59b1ee..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/02-tracking-dependencies-scope-output.json +++ /dev/null @@ -1,1960 +0,0 @@ -{ - "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": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "a", - "identifiers": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "range": [ - 14, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 18 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 150, - 151 - ], - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 214, - 215 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 5 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - } - ] - }, - { - "name": "b", - "identifiers": [ - { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 38, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - "range": [ - 34, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 18 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 192, - 193 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 220, - 221 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - } - ] - }, - { - "name": "sum", - "identifiers": [ - { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "add", - "range": [ - 69, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - "optional": false, - "range": [ - 69, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 60, - 75 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - "range": [ - 54, - 75 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 26 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 226, - 229 - ], - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ] - }, - { - "name": "add", - "identifiers": [ - { - "type": "Identifier", - "name": "add", - "range": [ - 88, - 91 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 13 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "add", - "range": [ - 88, - 91 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - "operator": "+", - "right": { - "type": "Identifier", - "name": "b", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - "range": [ - 98, - 111 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 15 - } - } - } - ], - "range": [ - 94, - 114 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 8, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "add", - "range": [ - 88, - 91 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "params": [], - "range": [ - 79, - 114 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 8, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "add", - "range": [ - 69, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "add", - "range": [ - 88, - 91 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 13 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "add", - "range": [ - 69, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "add", - "range": [ - 88, - 91 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 214, - 215 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 5 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 220, - 221 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 226, - 229 - ], - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 150, - 151 - ], - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 150, - 151 - ], - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 192, - 193 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 192, - 193 - ], - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte deleted file mode 100644 index 84f9c15b..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-input.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - - - -

{a} + {b} = {sum}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json deleted file mode 100644 index d4fc55f9..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-output.json +++ /dev/null @@ -1,3574 +0,0 @@ -{ - "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": "ImportDeclaration", - "source": { - "type": "Literal", - "raw": "'svelte'", - "value": "svelte", - "range": [ - 34, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - "specifiers": [ - { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "local": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - ], - "range": [ - 10, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 54, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - "range": [ - 50, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 18 - } - } - } - ], - "range": [ - 46, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - "range": [ - 70, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 18 - } - } - } - ], - "range": [ - 66, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "add", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "optional": false, - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 96, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 96, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 26 - } - } - }, - "range": [ - 90, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - ], - "range": [ - 86, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 27 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 141, - 142 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - "operator": "+", - "right": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "Identifier", - "name": "b", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 153, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 9, - "column": 28 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "untrack", - "range": [ - 145, - 152 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - "optional": false, - "range": [ - 145, - 161 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "range": [ - 141, - 161 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "range": [ - 134, - 162 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 30 - } - } - } - ], - "range": [ - 130, - 165 - ], - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "add", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 13 - } - } - }, - "params": [], - "range": [ - 115, - 165 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 166, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 9 - } - } - }, - "range": [ - 0, - 175 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 175, - 177 - ], - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 13, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 178, - 184 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 188, - 193 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 185, - 193 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "a", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 201, - 204 - ], - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 27 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 195, - 204 - ], - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 13, - "column": 27 - } - } - }, - "range": [ - 185, - 205 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 28 - } - } - } - ], - "selfClosing": false, - "range": [ - 177, - 206 - ], - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 29 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "a++", - "range": [ - 206, - 209 - ], - "loc": { - "start": { - "line": 13, - "column": 29 - }, - "end": { - "line": 13, - "column": 32 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 209, - 218 - ], - "loc": { - "start": { - "line": 13, - "column": 32 - }, - "end": { - "line": 13, - "column": 41 - } - } - }, - "range": [ - 177, - 218 - ], - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 41 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 218, - 219 - ], - "loc": { - "start": { - "line": 13, - "column": 41 - }, - "end": { - "line": 14, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 220, - 226 - ], - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 230, - 235 - ], - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 227, - 235 - ], - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 243, - 244 - ], - "loc": { - "start": { - "line": 14, - "column": 24 - }, - "end": { - "line": 14, - "column": 25 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 243, - 246 - ], - "loc": { - "start": { - "line": 14, - "column": 24 - }, - "end": { - "line": 14, - "column": 27 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 237, - 246 - ], - "loc": { - "start": { - "line": 14, - "column": 18 - }, - "end": { - "line": 14, - "column": 27 - } - } - }, - "range": [ - 227, - 247 - ], - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 28 - } - } - } - ], - "selfClosing": false, - "range": [ - 219, - 248 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 29 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "b++", - "range": [ - 248, - 251 - ], - "loc": { - "start": { - "line": 14, - "column": 29 - }, - "end": { - "line": 14, - "column": 32 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 251, - 260 - ], - "loc": { - "start": { - "line": 14, - "column": 32 - }, - "end": { - "line": 14, - "column": 41 - } - } - }, - "range": [ - 219, - 260 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 41 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 260, - 261 - ], - "loc": { - "start": { - "line": 14, - "column": 41 - }, - "end": { - "line": 15, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 262, - 263 - ], - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 2 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 261, - 264 - ], - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 15, - "column": 3 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "a", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 5 - } - } - }, - "range": [ - 264, - 267 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 6 - } - } - }, - { - "type": "SvelteText", - "value": " + ", - "range": [ - 267, - 270 - ], - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 15, - "column": 9 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "b", - "range": [ - 271, - 272 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 11 - } - } - }, - "range": [ - 270, - 273 - ], - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 12 - } - } - }, - { - "type": "SvelteText", - "value": " = ", - "range": [ - 273, - 276 - ], - "loc": { - "start": { - "line": 15, - "column": 12 - }, - "end": { - "line": 15, - "column": 15 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "sum", - "range": [ - 277, - 280 - ], - "loc": { - "start": { - "line": 15, - "column": 16 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "range": [ - 276, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 15 - }, - "end": { - "line": 15, - "column": 20 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 281, - 285 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 24 - } - } - }, - "range": [ - 261, - 285 - ], - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 15, - "column": 24 - } - } - } - ], - "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": "import", - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "from", - "range": [ - 29, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "String", - "value": "'svelte'", - "range": [ - 34, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 46, - 49 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 66, - 69 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 82, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 86, - 89 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "$derived", - "range": [ - 96, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 104, - 105 - ], - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "add", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 108, - 109 - ], - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 25 - }, - "end": { - "line": 6, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 111, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 26 - }, - "end": { - "line": 6, - "column": 27 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 115, - 123 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "add", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 127, - 128 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 128, - 129 - ], - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 130, - 131 - ], - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 134, - 140 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 141, - 142 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 143, - 144 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "untrack", - "range": [ - 145, - 152 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 152, - 153 - ], - "loc": { - "start": { - "line": 9, - "column": 20 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 153, - 154 - ], - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 9, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 154, - 155 - ], - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 156, - 158 - ], - "loc": { - "start": { - "line": 9, - "column": 24 - }, - "end": { - "line": 9, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 160, - 161 - ], - "loc": { - "start": { - "line": 9, - "column": 28 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 161, - 162 - ], - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 164, - 165 - ], - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 166, - 167 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 11, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 168, - 174 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 174, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 175, - 177 - ], - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 13, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 177, - 178 - ], - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 178, - 184 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 185, - 187 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 187, - 188 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 188, - 193 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 193, - 194 - ], - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 194, - 195 - ], - "loc": { - "start": { - "line": 13, - "column": 17 - }, - "end": { - "line": 13, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 195, - 196 - ], - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 196, - 197 - ], - "loc": { - "start": { - "line": 13, - "column": 19 - }, - "end": { - "line": 13, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 198, - 200 - ], - "loc": { - "start": { - "line": 13, - "column": 21 - }, - "end": { - "line": 13, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 202, - 204 - ], - "loc": { - "start": { - "line": 13, - "column": 25 - }, - "end": { - "line": 13, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 13, - "column": 27 - }, - "end": { - "line": 13, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 205, - 206 - ], - "loc": { - "start": { - "line": 13, - "column": 28 - }, - "end": { - "line": 13, - "column": 29 - } - } - }, - { - "type": "HTMLText", - "value": "a++", - "range": [ - 206, - 209 - ], - "loc": { - "start": { - "line": 13, - "column": 29 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 209, - 210 - ], - "loc": { - "start": { - "line": 13, - "column": 32 - }, - "end": { - "line": 13, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 210, - 211 - ], - "loc": { - "start": { - "line": 13, - "column": 33 - }, - "end": { - "line": 13, - "column": 34 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 211, - 217 - ], - "loc": { - "start": { - "line": 13, - "column": 34 - }, - "end": { - "line": 13, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 217, - 218 - ], - "loc": { - "start": { - "line": 13, - "column": 40 - }, - "end": { - "line": 13, - "column": 41 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 218, - 219 - ], - "loc": { - "start": { - "line": 13, - "column": 41 - }, - "end": { - "line": 14, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 219, - 220 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 220, - 226 - ], - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 227, - 229 - ], - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 229, - 230 - ], - "loc": { - "start": { - "line": 14, - "column": 10 - }, - "end": { - "line": 14, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 230, - 235 - ], - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 235, - 236 - ], - "loc": { - "start": { - "line": 14, - "column": 16 - }, - "end": { - "line": 14, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 236, - 237 - ], - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 237, - 238 - ], - "loc": { - "start": { - "line": 14, - "column": 18 - }, - "end": { - "line": 14, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 238, - 239 - ], - "loc": { - "start": { - "line": 14, - "column": 19 - }, - "end": { - "line": 14, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 240, - 242 - ], - "loc": { - "start": { - "line": 14, - "column": 21 - }, - "end": { - "line": 14, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 243, - 244 - ], - "loc": { - "start": { - "line": 14, - "column": 24 - }, - "end": { - "line": 14, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 244, - 246 - ], - "loc": { - "start": { - "line": 14, - "column": 25 - }, - "end": { - "line": 14, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 246, - 247 - ], - "loc": { - "start": { - "line": 14, - "column": 27 - }, - "end": { - "line": 14, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 247, - 248 - ], - "loc": { - "start": { - "line": 14, - "column": 28 - }, - "end": { - "line": 14, - "column": 29 - } - } - }, - { - "type": "HTMLText", - "value": "b++", - "range": [ - 248, - 251 - ], - "loc": { - "start": { - "line": 14, - "column": 29 - }, - "end": { - "line": 14, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 251, - 252 - ], - "loc": { - "start": { - "line": 14, - "column": 32 - }, - "end": { - "line": 14, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 252, - 253 - ], - "loc": { - "start": { - "line": 14, - "column": 33 - }, - "end": { - "line": 14, - "column": 34 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 253, - 259 - ], - "loc": { - "start": { - "line": 14, - "column": 34 - }, - "end": { - "line": 14, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 259, - 260 - ], - "loc": { - "start": { - "line": 14, - "column": 40 - }, - "end": { - "line": 14, - "column": 41 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 260, - 261 - ], - "loc": { - "start": { - "line": 14, - "column": 41 - }, - "end": { - "line": 15, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 261, - 262 - ], - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 15, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 262, - 263 - ], - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 263, - 264 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 264, - 265 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 266, - 267 - ], - "loc": { - "start": { - "line": 15, - "column": 5 - }, - "end": { - "line": 15, - "column": 6 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 267, - 268 - ], - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - { - "type": "HTMLText", - "value": "+", - "range": [ - 268, - 269 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 269, - 270 - ], - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 270, - 271 - ], - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 271, - 272 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 272, - 273 - ], - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 12 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 273, - 274 - ], - "loc": { - "start": { - "line": 15, - "column": 12 - }, - "end": { - "line": 15, - "column": 13 - } - } - }, - { - "type": "HTMLText", - "value": "=", - "range": [ - 274, - 275 - ], - "loc": { - "start": { - "line": 15, - "column": 13 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 275, - 276 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 276, - 277 - ], - "loc": { - "start": { - "line": 15, - "column": 15 - }, - "end": { - "line": 15, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "sum", - "range": [ - 277, - 280 - ], - "loc": { - "start": { - "line": 15, - "column": 16 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 280, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 282, - 283 - ], - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 15, - "column": 22 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 283, - 284 - ], - "loc": { - "start": { - "line": 15, - "column": 22 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 284, - 285 - ], - "loc": { - "start": { - "line": 15, - "column": 23 - }, - "end": { - "line": 15, - "column": 24 - } - } - } - ], - "range": [ - 0, - 286 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json deleted file mode 100644 index 49e55e1e..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "sum", - "line": 6, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json deleted file mode 100644 index 35f01e12..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/03-untracking-dependencies-scope-output.json +++ /dev/null @@ -1,2291 +0,0 @@ -{ - "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": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 96, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "untrack", - "identifiers": [ - { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - ], - "defs": [ - { - "type": "ImportBinding", - "name": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "node": { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "local": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "untrack", - "range": [ - 145, - 152 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - } - ] - }, - { - "name": "a", - "identifiers": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 54, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - "range": [ - 50, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 18 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 141, - 142 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 5 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - } - ] - }, - { - "name": "b", - "identifiers": [ - { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "optional": false, - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - "range": [ - 70, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 18 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 243, - 244 - ], - "loc": { - "start": { - "line": 14, - "column": 24 - }, - "end": { - "line": 14, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 271, - 272 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 11 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - } - ] - }, - { - "name": "sum", - "identifiers": [ - { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "add", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "optional": false, - "range": [ - 105, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 96, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 96, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 26 - } - } - }, - "range": [ - 90, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 26 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 277, - 280 - ], - "loc": { - "start": { - "line": 15, - "column": 16 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - } - } - ] - }, - { - "name": "add", - "identifiers": [ - { - "type": "Identifier", - "name": "add", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 13 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "add", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 13 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 141, - 142 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - "operator": "+", - "right": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "Identifier", - "name": "b", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 153, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 9, - "column": 28 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "untrack", - "range": [ - 145, - 152 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - "optional": false, - "range": [ - 145, - 161 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "range": [ - 141, - 161 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "range": [ - 134, - 162 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 30 - } - } - } - ], - "range": [ - 130, - 165 - ], - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "add", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 13 - } - } - }, - "params": [], - "range": [ - 115, - 165 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "add", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "add", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 13 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 96, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "add", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "add", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 5 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 271, - 272 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 11 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "sum", - "range": [ - 277, - 280 - ], - "loc": { - "start": { - "line": 15, - "column": 16 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "sum", - "range": [ - 90, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 141, - 142 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "untrack", - "range": [ - 145, - 152 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 141, - 142 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "untrack", - "range": [ - 145, - 152 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "untrack", - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 159, - 160 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 243, - 244 - ], - "loc": { - "start": { - "line": 14, - "column": 24 - }, - "end": { - "line": 14, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 243, - 244 - ], - "loc": { - "start": { - "line": 14, - "column": 24 - }, - "end": { - "line": 14, - "column": 25 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 96, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte deleted file mode 100644 index d7db5237..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-input.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -{count} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json deleted file mode 100644 index 23d91020..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-output.json +++ /dev/null @@ -1,732 +0,0 @@ -{ - "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": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "right": { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "range": [ - 14, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "optional": false, - "range": [ - 30, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - "range": [ - 14, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 29 - } - } - } - ], - "range": [ - 10, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 30 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 40, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 49, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 5, - "column": 0 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "count", - "range": [ - 52, - 57 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "range": [ - 51, - 58 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 7 - } - } - } - ], - "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": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "$props", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 42, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 49, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 5, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 52, - 57 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - } - } - ], - "range": [ - 0, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json deleted file mode 100644 index 3e0fd283..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "count", - "line": 2, - "column": 8 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json deleted file mode 100644 index 0cde141e..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/04-simple-component-props-scope-output.json +++ /dev/null @@ -1,585 +0,0 @@ -{ - "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": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "right": { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "range": [ - 14, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "optional": false, - "range": [ - 30, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - "range": [ - 14, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 29 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 52, - 57 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 52, - 57 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte deleted file mode 100644 index 56273b84..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-input.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - -
-	{JSON.stringify(others)}
-
diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json deleted file mode 100644 index ca05f181..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-output.json +++ /dev/null @@ -1,1387 +0,0 @@ -{ - "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": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "class", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "range": [ - 16, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - "range": [ - 34, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - ], - "range": [ - 14, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - "optional": false, - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "range": [ - 14, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 47 - } - } - } - ], - "range": [ - 10, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 48 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 58, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "range": [ - 0, - 67 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 67, - 69 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 5, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "pre", - "range": [ - 70, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteAttribute", - "key": { - "type": "SvelteName", - "name": "class", - "range": [ - 74, - 79 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - "boolean": false, - "value": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "classname", - "range": [ - 81, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - "range": [ - 80, - 91 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 22 - } - } - } - ], - "range": [ - 74, - 91 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 22 - } - } - } - ], - "selfClosing": false, - "range": [ - 69, - 92 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 92, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Identifier", - "name": "others", - "range": [ - 110, - 116 - ], - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 23 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "JSON", - "range": [ - 95, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "stringify", - "range": [ - 100, - 109 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "range": [ - 95, - 109 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "optional": false, - "range": [ - 95, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 24 - } - } - }, - "range": [ - 94, - 118 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 25 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 118, - 119 - ], - "loc": { - "start": { - "line": 6, - "column": 25 - }, - "end": { - "line": 7, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 119, - 125 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 6 - } - } - }, - "range": [ - 69, - 125 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 7, - "column": 6 - } - } - } - ], - "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": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "class", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": "Identifier", - "value": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 45 - }, - "end": { - "line": 2, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 47 - }, - "end": { - "line": 2, - "column": 48 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 60, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 67, - 69 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 5, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "pre", - "range": [ - 70, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "class", - "range": [ - 74, - 79 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "classname", - "range": [ - 81, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 90, - 91 - ], - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 91, - 92 - ], - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 92, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "JSON", - "range": [ - 95, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 99, - 100 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "stringify", - "range": [ - 100, - 109 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "others", - "range": [ - 110, - 116 - ], - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 116, - 117 - ], - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 117, - 118 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 25 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 118, - 119 - ], - "loc": { - "start": { - "line": 6, - "column": 25 - }, - "end": { - "line": 7, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 119, - 120 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 120, - 121 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "pre", - "range": [ - 121, - 124 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 124, - 125 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 6 - } - } - } - ], - "range": [ - 0, - 126 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json deleted file mode 100644 index 1413498b..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-prefer-const-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "classname", - "line": 2, - "column": 15 - }, - { - "ruleId": "prefer-const", - "code": "others", - "line": 2, - "column": 29 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json deleted file mode 100644 index ba9b7a52..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-requirements.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "test": { - "eslint": ">=8.0.0" - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json deleted file mode 100644 index aeae4efe..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/05-advanced-component-props-scope-output.json +++ /dev/null @@ -1,947 +0,0 @@ -{ - "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": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "classname", - "identifiers": [ - { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "class", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "range": [ - 16, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - "range": [ - 34, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - ], - "range": [ - 14, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - "optional": false, - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "range": [ - 14, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 47 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "classname", - "range": [ - 81, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - } - ] - }, - { - "name": "others", - "identifiers": [ - { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "class", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "range": [ - 16, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - "range": [ - 34, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - ], - "range": [ - 14, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - "optional": false, - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "range": [ - 14, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 47 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "others", - "range": [ - 110, - 116 - ], - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "classname", - "range": [ - 81, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "classname", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "JSON", - "range": [ - 95, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "others", - "range": [ - 110, - 116 - ], - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "others", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 48, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "JSON", - "range": [ - 95, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "JSON", - "range": [ - 95, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte deleted file mode 100644 index b80c0f47..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-input.svelte +++ /dev/null @@ -1,48 +0,0 @@ - - -
-
- {#each messages as message} -

{message}

- {/each} -
- - - - -
diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json deleted file mode 100644 index 6086a019..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-undef-result.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "ruleId": "no-undef", - "code": "toggleValue", - "line": 32, - "column": 3 - }, - { - "ruleId": "no-undef", - "code": "toggleValue", - "line": 32, - "column": 18 - }, - { - "ruleId": "no-undef", - "code": "viewport", - "line": 37, - "column": 18 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json deleted file mode 100644 index 06b0d10f..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-no-unused-expressions-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-unused-expressions", - "code": "messages;", - "line": 10, - "column": 3 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json deleted file mode 100644 index af1e13d5..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-output.json +++ /dev/null @@ -1,7513 +0,0 @@ -{ - "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": "ImportDeclaration", - "source": { - "type": "Literal", - "raw": "'svelte'", - "value": "svelte", - "range": [ - 31, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - "specifiers": [ - { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "local": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - ], - "range": [ - 10, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "'dark'", - "value": "dark", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 26 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 55, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - "range": [ - 47, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 27 - } - } - } - ], - "range": [ - 43, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrayExpression", - "elements": [], - "range": [ - 94, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 87, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 26 - } - } - }, - "range": [ - 76, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 26 - } - } - } - ], - "range": [ - 72, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 27 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "init": null, - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - ], - "range": [ - 101, - 109 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "messages", - "range": [ - 134, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "range": [ - 134, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "const", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - "init": { - "type": "LogicalExpression", - "left": { - "type": "Identifier", - "name": "div", - "range": [ - 165, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 24 - } - } - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "left": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 172, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 31 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "offsetHeight", - "range": [ - 176, - 188 - ], - "loc": { - "start": { - "line": 11, - "column": 32 - }, - "end": { - "line": 11, - "column": 44 - } - } - }, - "range": [ - 172, - 188 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 44 - } - } - }, - "operator": "+", - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 191, - 194 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 50 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollTop", - "range": [ - 195, - 204 - ], - "loc": { - "start": { - "line": 11, - "column": 51 - }, - "end": { - "line": 11, - "column": 60 - } - } - }, - "range": [ - 191, - 204 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 60 - } - } - }, - "range": [ - 172, - 204 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 60 - } - } - }, - "operator": ">", - "right": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 207, - 210 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 66 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollHeight", - "range": [ - 211, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 67 - }, - "end": { - "line": 11, - "column": 79 - } - } - }, - "range": [ - 207, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 79 - } - } - }, - "operator": "-", - "right": { - "type": "Literal", - "raw": "50", - "value": 50, - "range": [ - 226, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 82 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 207, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 172, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 165, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 152, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 84 - } - } - } - ], - "range": [ - 146, - 229 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 85 - } - } - }, - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 291, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 18 - } - } - }, - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 294, - 297 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollHeight", - "range": [ - 298, - 310 - ], - "loc": { - "start": { - "line": 15, - "column": 24 - }, - "end": { - "line": 15, - "column": 36 - } - } - }, - "range": [ - 294, - 310 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 36 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollTo", - "range": [ - 282, - 290 - ], - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 16 - } - } - }, - "range": [ - 278, - 290 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 16 - } - } - }, - "optional": false, - "range": [ - 278, - 311 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 37 - } - } - }, - "range": [ - 278, - 312 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 38 - } - } - } - ], - "range": [ - 272, - 317 - ], - "loc": { - "start": { - "line": 14, - "column": 21 - }, - "end": { - "line": 16, - "column": 4 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 266, - 317 - ], - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 16, - "column": 4 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "tick", - "range": [ - 254, - 258 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - "optional": false, - "range": [ - 254, - 260 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "then", - "range": [ - 261, - 265 - ], - "loc": { - "start": { - "line": 14, - "column": 10 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - "range": [ - 254, - 265 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - "optional": false, - "range": [ - 254, - 318 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 16, - "column": 5 - } - } - }, - "range": [ - 254, - 319 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 16, - "column": 6 - } - } - } - ], - "range": [ - 249, - 323 - ], - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 17, - "column": 3 - } - } - }, - "test": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 237, - 247 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - "range": [ - 233, - 323 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ], - "range": [ - 130, - 327 - ], - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 124, - 327 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 19, - "column": 2 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "$effect", - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "pre", - "range": [ - 120, - 123 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - "range": [ - 112, - 123 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - "optional": false, - "range": [ - 112, - 328 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 19, - "column": 3 - } - } - }, - "range": [ - 112, - 329 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 19, - "column": 4 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "const", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - "init": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 417, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "range": [ - 411, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 424, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 411, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 404, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 34 - } - } - } - ], - "range": [ - 398, - 430 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 35 - } - } - }, - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "ReturnStatement", - "argument": null, - "range": [ - 445, - 452 - ], - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - "test": { - "type": "UnaryExpression", - "argument": { - "type": "Identifier", - "name": "text", - "range": [ - 439, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 438, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "range": [ - 434, - 452 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "operator": "=", - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "SpreadElement", - "argument": { - "type": "Identifier", - "name": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "range": [ - 469, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 15 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - { - "type": "Identifier", - "name": "text", - "range": [ - 482, - 486 - ], - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 32 - } - } - } - ], - "range": [ - 468, - 487 - ], - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - "range": [ - 457, - 487 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - "range": [ - 457, - 488 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 34 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 492, - 497 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 498, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 15 - } - } - }, - "range": [ - 492, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 15 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 505, - 510 - ], - "loc": { - "start": { - "line": 27, - "column": 16 - }, - "end": { - "line": 27, - "column": 21 - } - } - }, - "range": [ - 492, - 510 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 21 - } - } - }, - "operator": "=", - "right": { - "type": "Literal", - "raw": "''", - "value": "", - "range": [ - 513, - 515 - ], - "loc": { - "start": { - "line": 27, - "column": 24 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - "range": [ - 492, - 515 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - "range": [ - 492, - 516 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 27 - } - } - } - ], - "range": [ - 393, - 520 - ], - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 28, - "column": 3 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 370, - 375 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "key", - "range": [ - 376, - 379 - ], - "loc": { - "start": { - "line": 22, - "column": 12 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - "range": [ - 370, - 379 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - "operator": "===", - "right": { - "type": "Literal", - "raw": "'Enter'", - "value": "Enter", - "range": [ - 384, - 391 - ], - "loc": { - "start": { - "line": 22, - "column": 20 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "range": [ - 370, - 391 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "range": [ - 366, - 520 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - } - } - } - ], - "range": [ - 362, - 523 - ], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 29, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - ], - "range": [ - 332, - 523 - ], - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 29, - "column": 2 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 548, - 559 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "operator": "=", - "right": { - "type": "UnaryExpression", - "argument": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 563, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 562, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 16 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "range": [ - 548, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "range": [ - 548, - 575 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 29 - } - } - } - ], - "range": [ - 544, - 578 - ], - "loc": { - "start": { - "line": 31, - "column": 19 - }, - "end": { - "line": 33, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "toggle", - "range": [ - 535, - 541 - ], - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - "params": [], - "range": [ - 526, - 578 - ], - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 33, - "column": 2 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 579, - 588 - ], - "loc": { - "start": { - "line": 34, - "column": 0 - }, - "end": { - "line": 34, - "column": 9 - } - } - }, - "range": [ - 0, - 588 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 34, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 588, - 590 - ], - "loc": { - "start": { - "line": 34, - "column": 9 - }, - "end": { - "line": 36, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "div", - "range": [ - 591, - 594 - ], - "loc": { - "start": { - "line": 36, - "column": 1 - }, - "end": { - "line": 36, - "column": 4 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "Class", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "dark", - "range": [ - 601, - 605 - ], - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 15 - } - } - }, - "modifiers": [], - "range": [ - 595, - 605 - ], - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 15 - } - } - }, - "expression": { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "theme", - "range": [ - 607, - 612 - ], - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 22 - } - } - }, - "operator": "===", - "right": { - "type": "Literal", - "raw": "'dark'", - "value": "dark", - "range": [ - 617, - 623 - ], - "loc": { - "start": { - "line": 36, - "column": 27 - }, - "end": { - "line": 36, - "column": 33 - } - } - }, - "range": [ - 607, - 623 - ], - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 33 - } - } - }, - "shorthand": false, - "range": [ - 595, - 624 - ], - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 34 - } - } - } - ], - "selfClosing": false, - "range": [ - 590, - 625 - ], - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 35 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 625, - 627 - ], - "loc": { - "start": { - "line": 36, - "column": 35 - }, - "end": { - "line": 37, - "column": 1 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "div", - "range": [ - 628, - 631 - ], - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 5 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "Binding", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "this", - "range": [ - 637, - 641 - ], - "loc": { - "start": { - "line": 37, - "column": 11 - }, - "end": { - "line": 37, - "column": 15 - } - } - }, - "modifiers": [], - "range": [ - 632, - 641 - ], - "loc": { - "start": { - "line": 37, - "column": 6 - }, - "end": { - "line": 37, - "column": 15 - } - } - }, - "expression": { - "type": "Identifier", - "name": "viewport", - "range": [ - 643, - 651 - ], - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - } - }, - "shorthand": false, - "range": [ - 632, - 652 - ], - "loc": { - "start": { - "line": 37, - "column": 6 - }, - "end": { - "line": 37, - "column": 26 - } - } - } - ], - "selfClosing": false, - "range": [ - 627, - 653 - ], - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 27 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t\t", - "range": [ - 653, - 656 - ], - "loc": { - "start": { - "line": 37, - "column": 27 - }, - "end": { - "line": 38, - "column": 2 - } - } - }, - { - "type": "SvelteEachBlock", - "expression": { - "type": "Identifier", - "name": "messages", - "range": [ - 663, - 671 - ], - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 17 - } - } - }, - "context": { - "type": "Identifier", - "name": "message", - "range": [ - 675, - 682 - ], - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 28 - } - } - }, - "index": null, - "key": null, - "children": [ - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 688, - 689 - ], - "loc": { - "start": { - "line": 39, - "column": 4 - }, - "end": { - "line": 39, - "column": 5 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 687, - 690 - ], - "loc": { - "start": { - "line": 39, - "column": 3 - }, - "end": { - "line": 39, - "column": 6 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "message", - "range": [ - 691, - 698 - ], - "loc": { - "start": { - "line": 39, - "column": 7 - }, - "end": { - "line": 39, - "column": 14 - } - } - }, - "range": [ - 690, - 699 - ], - "loc": { - "start": { - "line": 39, - "column": 6 - }, - "end": { - "line": 39, - "column": 15 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 699, - 703 - ], - "loc": { - "start": { - "line": 39, - "column": 15 - }, - "end": { - "line": 39, - "column": 19 - } - } - }, - "range": [ - 687, - 703 - ], - "loc": { - "start": { - "line": 39, - "column": 3 - }, - "end": { - "line": 39, - "column": 19 - } - } - } - ], - "else": null, - "range": [ - 656, - 713 - ], - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 40, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 713, - 715 - ], - "loc": { - "start": { - "line": 40, - "column": 9 - }, - "end": { - "line": 41, - "column": 1 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 715, - 721 - ], - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 41, - "column": 7 - } - } - }, - "range": [ - 627, - 721 - ], - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 41, - "column": 7 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n\t", - "range": [ - 721, - 724 - ], - "loc": { - "start": { - "line": 41, - "column": 7 - }, - "end": { - "line": 43, - "column": 1 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "input", - "range": [ - 725, - 730 - ], - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 43, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "keydown", - "range": [ - 734, - 741 - ], - "loc": { - "start": { - "line": 43, - "column": 11 - }, - "end": { - "line": 43, - "column": 18 - } - } - }, - "modifiers": [], - "range": [ - 731, - 741 - ], - "loc": { - "start": { - "line": 43, - "column": 8 - }, - "end": { - "line": 43, - "column": 18 - } - } - }, - "expression": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 743, - 756 - ], - "loc": { - "start": { - "line": 43, - "column": 20 - }, - "end": { - "line": 43, - "column": 33 - } - } - }, - "range": [ - 731, - 757 - ], - "loc": { - "start": { - "line": 43, - "column": 8 - }, - "end": { - "line": 43, - "column": 34 - } - } - } - ], - "selfClosing": true, - "range": [ - 724, - 760 - ], - "loc": { - "start": { - "line": 43, - "column": 1 - }, - "end": { - "line": 43, - "column": 37 - } - } - }, - "children": [], - "endTag": null, - "range": [ - 724, - 760 - ], - "loc": { - "start": { - "line": 43, - "column": 1 - }, - "end": { - "line": 43, - "column": 37 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n\t", - "range": [ - 760, - 763 - ], - "loc": { - "start": { - "line": 43, - "column": 37 - }, - "end": { - "line": 45, - "column": 1 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 764, - 770 - ], - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 8 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 774, - 779 - ], - "loc": { - "start": { - "line": 45, - "column": 12 - }, - "end": { - "line": 45, - "column": 17 - } - } - }, - "modifiers": [], - "range": [ - 771, - 779 - ], - "loc": { - "start": { - "line": 45, - "column": 9 - }, - "end": { - "line": 45, - "column": 17 - } - } - }, - "expression": { - "type": "Identifier", - "name": "toggle", - "range": [ - 781, - 787 - ], - "loc": { - "start": { - "line": 45, - "column": 19 - }, - "end": { - "line": 45, - "column": 25 - } - } - }, - "range": [ - 771, - 788 - ], - "loc": { - "start": { - "line": 45, - "column": 9 - }, - "end": { - "line": 45, - "column": 26 - } - } - } - ], - "selfClosing": false, - "range": [ - 763, - 789 - ], - "loc": { - "start": { - "line": 45, - "column": 1 - }, - "end": { - "line": 45, - "column": 27 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t\tToggle dark mode\n\t", - "range": [ - 789, - 810 - ], - "loc": { - "start": { - "line": 45, - "column": 27 - }, - "end": { - "line": 47, - "column": 1 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 810, - 819 - ], - "loc": { - "start": { - "line": 47, - "column": 1 - }, - "end": { - "line": 47, - "column": 10 - } - } - }, - "range": [ - 763, - 819 - ], - "loc": { - "start": { - "line": 45, - "column": 1 - }, - "end": { - "line": 47, - "column": 10 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 819, - 820 - ], - "loc": { - "start": { - "line": 47, - "column": 10 - }, - "end": { - "line": 48, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 820, - 826 - ], - "loc": { - "start": { - "line": 48, - "column": 0 - }, - "end": { - "line": 48, - "column": 6 - } - } - }, - "range": [ - 590, - 826 - ], - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 48, - "column": 6 - } - } - } - ], - "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": "import", - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "from", - "range": [ - 26, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "String", - "value": "'svelte'", - "range": [ - 31, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "String", - "value": "'dark'", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 72, - 75 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 85, - 86 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 93, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 25 - }, - "end": { - "line": 5, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 97, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 26 - }, - "end": { - "line": 5, - "column": 27 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 101, - 104 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 108, - 109 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "$effect", - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 119, - 120 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "pre", - "range": [ - 120, - 123 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 124, - 125 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 125, - 126 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 127, - 129 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 130, - 131 - ], - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 134, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 142, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 146, - 151 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 163, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 19 - }, - "end": { - "line": 11, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 165, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "&&", - "range": [ - 169, - 171 - ], - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 172, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 175, - 176 - ], - "loc": { - "start": { - "line": 11, - "column": 31 - }, - "end": { - "line": 11, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "offsetHeight", - "range": [ - 176, - 188 - ], - "loc": { - "start": { - "line": 11, - "column": 32 - }, - "end": { - "line": 11, - "column": 44 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 189, - 190 - ], - "loc": { - "start": { - "line": 11, - "column": 45 - }, - "end": { - "line": 11, - "column": 46 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 191, - 194 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 50 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 194, - 195 - ], - "loc": { - "start": { - "line": 11, - "column": 50 - }, - "end": { - "line": 11, - "column": 51 - } - } - }, - { - "type": "Identifier", - "value": "scrollTop", - "range": [ - 195, - 204 - ], - "loc": { - "start": { - "line": 11, - "column": 51 - }, - "end": { - "line": 11, - "column": 60 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 205, - 206 - ], - "loc": { - "start": { - "line": 11, - "column": 61 - }, - "end": { - "line": 11, - "column": 62 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 207, - 210 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 66 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 210, - 211 - ], - "loc": { - "start": { - "line": 11, - "column": 66 - }, - "end": { - "line": 11, - "column": 67 - } - } - }, - { - "type": "Identifier", - "value": "scrollHeight", - "range": [ - 211, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 67 - }, - "end": { - "line": 11, - "column": 79 - } - } - }, - { - "type": "Punctuator", - "value": "-", - "range": [ - 224, - 225 - ], - "loc": { - "start": { - "line": 11, - "column": 80 - }, - "end": { - "line": 11, - "column": 81 - } - } - }, - { - "type": "Numeric", - "value": "50", - "range": [ - 226, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 82 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 228, - 229 - ], - "loc": { - "start": { - "line": 11, - "column": 84 - }, - "end": { - "line": 11, - "column": 85 - } - } - }, - { - "type": "Keyword", - "value": "if", - "range": [ - 233, - 235 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 236, - 237 - ], - "loc": { - "start": { - "line": 13, - "column": 5 - }, - "end": { - "line": 13, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "autoscroll", - "range": [ - 237, - 247 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 247, - 248 - ], - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 249, - 250 - ], - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "tick", - "range": [ - 254, - 258 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 258, - 259 - ], - "loc": { - "start": { - "line": 14, - "column": 7 - }, - "end": { - "line": 14, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 259, - 260 - ], - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 260, - 261 - ], - "loc": { - "start": { - "line": 14, - "column": 9 - }, - "end": { - "line": 14, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "then", - "range": [ - 261, - 265 - ], - "loc": { - "start": { - "line": 14, - "column": 10 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 14, - "column": 14 - }, - "end": { - "line": 14, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 266, - 267 - ], - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 267, - 268 - ], - "loc": { - "start": { - "line": 14, - "column": 16 - }, - "end": { - "line": 14, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 269, - 271 - ], - "loc": { - "start": { - "line": 14, - "column": 18 - }, - "end": { - "line": 14, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 272, - 273 - ], - "loc": { - "start": { - "line": 14, - "column": 21 - }, - "end": { - "line": 14, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "scrollTo", - "range": [ - 282, - 290 - ], - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 290, - 291 - ], - "loc": { - "start": { - "line": 15, - "column": 16 - }, - "end": { - "line": 15, - "column": 17 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 291, - 292 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 292, - 293 - ], - "loc": { - "start": { - "line": 15, - "column": 18 - }, - "end": { - "line": 15, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 294, - 297 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 297, - 298 - ], - "loc": { - "start": { - "line": 15, - "column": 23 - }, - "end": { - "line": 15, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "scrollHeight", - "range": [ - 298, - 310 - ], - "loc": { - "start": { - "line": 15, - "column": 24 - }, - "end": { - "line": 15, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 310, - 311 - ], - "loc": { - "start": { - "line": 15, - "column": 36 - }, - "end": { - "line": 15, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 311, - 312 - ], - "loc": { - "start": { - "line": 15, - "column": 37 - }, - "end": { - "line": 15, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 316, - 317 - ], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 317, - 318 - ], - "loc": { - "start": { - "line": 16, - "column": 4 - }, - "end": { - "line": 16, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 318, - 319 - ], - "loc": { - "start": { - "line": 16, - "column": 5 - }, - "end": { - "line": 16, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 322, - 323 - ], - "loc": { - "start": { - "line": 17, - "column": 2 - }, - "end": { - "line": 17, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 326, - 327 - ], - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 327, - 328 - ], - "loc": { - "start": { - "line": 19, - "column": 2 - }, - "end": { - "line": 19, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 328, - 329 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 4 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 332, - 340 - ], - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 354, - 355 - ], - "loc": { - "start": { - "line": 21, - "column": 23 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 360, - 361 - ], - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 362, - 363 - ], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 32 - } - } - }, - { - "type": "Keyword", - "value": "if", - "range": [ - 366, - 368 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 369, - 370 - ], - "loc": { - "start": { - "line": 22, - "column": 5 - }, - "end": { - "line": 22, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 370, - 375 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 375, - 376 - ], - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "key", - "range": [ - 376, - 379 - ], - "loc": { - "start": { - "line": 22, - "column": 12 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "===", - "range": [ - 380, - 383 - ], - "loc": { - "start": { - "line": 22, - "column": 16 - }, - "end": { - "line": 22, - "column": 19 - } - } - }, - { - "type": "String", - "value": "'Enter'", - "range": [ - 384, - 391 - ], - "loc": { - "start": { - "line": 22, - "column": 20 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 391, - 392 - ], - "loc": { - "start": { - "line": 22, - "column": 27 - }, - "end": { - "line": 22, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 393, - 394 - ], - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 398, - 403 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 409, - 410 - ], - "loc": { - "start": { - "line": 23, - "column": 14 - }, - "end": { - "line": 23, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 416, - 417 - ], - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "target", - "range": [ - 417, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 423, - 424 - ], - "loc": { - "start": { - "line": 23, - "column": 28 - }, - "end": { - "line": 23, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 424, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 429, - 430 - ], - "loc": { - "start": { - "line": 23, - "column": 34 - }, - "end": { - "line": 23, - "column": 35 - } - } - }, - { - "type": "Keyword", - "value": "if", - "range": [ - 434, - 436 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 437, - 438 - ], - "loc": { - "start": { - "line": 24, - "column": 6 - }, - "end": { - "line": 24, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "!", - "range": [ - 438, - 439 - ], - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 439, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 443, - 444 - ], - "loc": { - "start": { - "line": 24, - "column": 12 - }, - "end": { - "line": 24, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 445, - 451 - ], - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 451, - 452 - ], - "loc": { - "start": { - "line": 24, - "column": 20 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 466, - 467 - ], - "loc": { - "start": { - "line": 26, - "column": 12 - }, - "end": { - "line": 26, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 468, - 469 - ], - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 469, - 472 - ], - "loc": { - "start": { - "line": 26, - "column": 15 - }, - "end": { - "line": 26, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 480, - 481 - ], - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "text", - "range": [ - 482, - 486 - ], - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 486, - 487 - ], - "loc": { - "start": { - "line": 26, - "column": 32 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 487, - 488 - ], - "loc": { - "start": { - "line": 26, - "column": 33 - }, - "end": { - "line": 26, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "event", - "range": [ - 492, - 497 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 497, - 498 - ], - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "target", - "range": [ - 498, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 504, - 505 - ], - "loc": { - "start": { - "line": 27, - "column": 15 - }, - "end": { - "line": 27, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "value", - "range": [ - 505, - 510 - ], - "loc": { - "start": { - "line": 27, - "column": 16 - }, - "end": { - "line": 27, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 511, - 512 - ], - "loc": { - "start": { - "line": 27, - "column": 22 - }, - "end": { - "line": 27, - "column": 23 - } - } - }, - { - "type": "String", - "value": "''", - "range": [ - 513, - 515 - ], - "loc": { - "start": { - "line": 27, - "column": 24 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 515, - 516 - ], - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 519, - 520 - ], - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 522, - 523 - ], - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 2 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 526, - 534 - ], - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "toggle", - "range": [ - 535, - 541 - ], - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 541, - 542 - ], - "loc": { - "start": { - "line": 31, - "column": 16 - }, - "end": { - "line": 31, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 542, - 543 - ], - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 544, - 545 - ], - "loc": { - "start": { - "line": 31, - "column": 19 - }, - "end": { - "line": 31, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "toggleValue", - "range": [ - 548, - 559 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 560, - 561 - ], - "loc": { - "start": { - "line": 32, - "column": 14 - }, - "end": { - "line": 32, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "!", - "range": [ - 562, - 563 - ], - "loc": { - "start": { - "line": 32, - "column": 16 - }, - "end": { - "line": 32, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "toggleValue", - "range": [ - 563, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 574, - 575 - ], - "loc": { - "start": { - "line": 32, - "column": 28 - }, - "end": { - "line": 32, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 577, - 578 - ], - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 579, - 580 - ], - "loc": { - "start": { - "line": 34, - "column": 0 - }, - "end": { - "line": 34, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 580, - 581 - ], - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 581, - 587 - ], - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 34, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 587, - 588 - ], - "loc": { - "start": { - "line": 34, - "column": 8 - }, - "end": { - "line": 34, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 588, - 590 - ], - "loc": { - "start": { - "line": 34, - "column": 9 - }, - "end": { - "line": 36, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 590, - 591 - ], - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "div", - "range": [ - 591, - 594 - ], - "loc": { - "start": { - "line": 36, - "column": 1 - }, - "end": { - "line": 36, - "column": 4 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "class", - "range": [ - 595, - 600 - ], - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 600, - 601 - ], - "loc": { - "start": { - "line": 36, - "column": 10 - }, - "end": { - "line": 36, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "dark", - "range": [ - 601, - 605 - ], - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 605, - 606 - ], - "loc": { - "start": { - "line": 36, - "column": 15 - }, - "end": { - "line": 36, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 606, - 607 - ], - "loc": { - "start": { - "line": 36, - "column": 16 - }, - "end": { - "line": 36, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "theme", - "range": [ - 607, - 612 - ], - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "===", - "range": [ - 613, - 616 - ], - "loc": { - "start": { - "line": 36, - "column": 23 - }, - "end": { - "line": 36, - "column": 26 - } - } - }, - { - "type": "String", - "value": "'dark'", - "range": [ - 617, - 623 - ], - "loc": { - "start": { - "line": 36, - "column": 27 - }, - "end": { - "line": 36, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 623, - 624 - ], - "loc": { - "start": { - "line": 36, - "column": 33 - }, - "end": { - "line": 36, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 624, - 625 - ], - "loc": { - "start": { - "line": 36, - "column": 34 - }, - "end": { - "line": 36, - "column": 35 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 625, - 627 - ], - "loc": { - "start": { - "line": 36, - "column": 35 - }, - "end": { - "line": 37, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 627, - 628 - ], - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "div", - "range": [ - 628, - 631 - ], - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 5 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "bind", - "range": [ - 632, - 636 - ], - "loc": { - "start": { - "line": 37, - "column": 6 - }, - "end": { - "line": 37, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 636, - 637 - ], - "loc": { - "start": { - "line": 37, - "column": 10 - }, - "end": { - "line": 37, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "this", - "range": [ - 637, - 641 - ], - "loc": { - "start": { - "line": 37, - "column": 11 - }, - "end": { - "line": 37, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 641, - 642 - ], - "loc": { - "start": { - "line": 37, - "column": 15 - }, - "end": { - "line": 37, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 642, - 643 - ], - "loc": { - "start": { - "line": 37, - "column": 16 - }, - "end": { - "line": 37, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "viewport", - "range": [ - 643, - 651 - ], - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 651, - 652 - ], - "loc": { - "start": { - "line": 37, - "column": 25 - }, - "end": { - "line": 37, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 652, - 653 - ], - "loc": { - "start": { - "line": 37, - "column": 26 - }, - "end": { - "line": 37, - "column": 27 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t\t", - "range": [ - 653, - 656 - ], - "loc": { - "start": { - "line": 37, - "column": 27 - }, - "end": { - "line": 38, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 656, - 657 - ], - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 3 - } - } - }, - { - "type": "MustacheKeyword", - "value": "#each", - "range": [ - 657, - 662 - ], - "loc": { - "start": { - "line": 38, - "column": 3 - }, - "end": { - "line": 38, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 663, - 671 - ], - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "as", - "range": [ - 672, - 674 - ], - "loc": { - "start": { - "line": 38, - "column": 18 - }, - "end": { - "line": 38, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "message", - "range": [ - 675, - 682 - ], - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 682, - 683 - ], - "loc": { - "start": { - "line": 38, - "column": 28 - }, - "end": { - "line": 38, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 687, - 688 - ], - "loc": { - "start": { - "line": 39, - "column": 3 - }, - "end": { - "line": 39, - "column": 4 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 688, - 689 - ], - "loc": { - "start": { - "line": 39, - "column": 4 - }, - "end": { - "line": 39, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 689, - 690 - ], - "loc": { - "start": { - "line": 39, - "column": 5 - }, - "end": { - "line": 39, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 690, - 691 - ], - "loc": { - "start": { - "line": 39, - "column": 6 - }, - "end": { - "line": 39, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "message", - "range": [ - 691, - 698 - ], - "loc": { - "start": { - "line": 39, - "column": 7 - }, - "end": { - "line": 39, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 698, - 699 - ], - "loc": { - "start": { - "line": 39, - "column": 14 - }, - "end": { - "line": 39, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 699, - 700 - ], - "loc": { - "start": { - "line": 39, - "column": 15 - }, - "end": { - "line": 39, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 700, - 701 - ], - "loc": { - "start": { - "line": 39, - "column": 16 - }, - "end": { - "line": 39, - "column": 17 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 701, - 702 - ], - "loc": { - "start": { - "line": 39, - "column": 17 - }, - "end": { - "line": 39, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 702, - 703 - ], - "loc": { - "start": { - "line": 39, - "column": 18 - }, - "end": { - "line": 39, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 706, - 707 - ], - "loc": { - "start": { - "line": 40, - "column": 2 - }, - "end": { - "line": 40, - "column": 3 - } - } - }, - { - "type": "MustacheKeyword", - "value": "/each", - "range": [ - 707, - 712 - ], - "loc": { - "start": { - "line": 40, - "column": 3 - }, - "end": { - "line": 40, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 712, - 713 - ], - "loc": { - "start": { - "line": 40, - "column": 8 - }, - "end": { - "line": 40, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 713, - 715 - ], - "loc": { - "start": { - "line": 40, - "column": 9 - }, - "end": { - "line": 41, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 715, - 716 - ], - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 41, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 716, - 717 - ], - "loc": { - "start": { - "line": 41, - "column": 2 - }, - "end": { - "line": 41, - "column": 3 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "div", - "range": [ - 717, - 720 - ], - "loc": { - "start": { - "line": 41, - "column": 3 - }, - "end": { - "line": 41, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 720, - 721 - ], - "loc": { - "start": { - "line": 41, - "column": 6 - }, - "end": { - "line": 41, - "column": 7 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n\t", - "range": [ - 721, - 724 - ], - "loc": { - "start": { - "line": 41, - "column": 7 - }, - "end": { - "line": 43, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 724, - 725 - ], - "loc": { - "start": { - "line": 43, - "column": 1 - }, - "end": { - "line": 43, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "input", - "range": [ - 725, - 730 - ], - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 43, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 731, - 733 - ], - "loc": { - "start": { - "line": 43, - "column": 8 - }, - "end": { - "line": 43, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 733, - 734 - ], - "loc": { - "start": { - "line": 43, - "column": 10 - }, - "end": { - "line": 43, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "keydown", - "range": [ - 734, - 741 - ], - "loc": { - "start": { - "line": 43, - "column": 11 - }, - "end": { - "line": 43, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 741, - 742 - ], - "loc": { - "start": { - "line": 43, - "column": 18 - }, - "end": { - "line": 43, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 742, - 743 - ], - "loc": { - "start": { - "line": 43, - "column": 19 - }, - "end": { - "line": 43, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "handleKeydown", - "range": [ - 743, - 756 - ], - "loc": { - "start": { - "line": 43, - "column": 20 - }, - "end": { - "line": 43, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 756, - 757 - ], - "loc": { - "start": { - "line": 43, - "column": 33 - }, - "end": { - "line": 43, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 758, - 759 - ], - "loc": { - "start": { - "line": 43, - "column": 35 - }, - "end": { - "line": 43, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 759, - 760 - ], - "loc": { - "start": { - "line": 43, - "column": 36 - }, - "end": { - "line": 43, - "column": 37 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n\t", - "range": [ - 760, - 763 - ], - "loc": { - "start": { - "line": 43, - "column": 37 - }, - "end": { - "line": 45, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 763, - 764 - ], - "loc": { - "start": { - "line": 45, - "column": 1 - }, - "end": { - "line": 45, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 764, - 770 - ], - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 8 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 771, - 773 - ], - "loc": { - "start": { - "line": 45, - "column": 9 - }, - "end": { - "line": 45, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 773, - 774 - ], - "loc": { - "start": { - "line": 45, - "column": 11 - }, - "end": { - "line": 45, - "column": 12 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 774, - 779 - ], - "loc": { - "start": { - "line": 45, - "column": 12 - }, - "end": { - "line": 45, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 779, - 780 - ], - "loc": { - "start": { - "line": 45, - "column": 17 - }, - "end": { - "line": 45, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 780, - 781 - ], - "loc": { - "start": { - "line": 45, - "column": 18 - }, - "end": { - "line": 45, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "toggle", - "range": [ - 781, - 787 - ], - "loc": { - "start": { - "line": 45, - "column": 19 - }, - "end": { - "line": 45, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 787, - 788 - ], - "loc": { - "start": { - "line": 45, - "column": 25 - }, - "end": { - "line": 45, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 788, - 789 - ], - "loc": { - "start": { - "line": 45, - "column": 26 - }, - "end": { - "line": 45, - "column": 27 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t\t", - "range": [ - 789, - 792 - ], - "loc": { - "start": { - "line": 45, - "column": 27 - }, - "end": { - "line": 46, - "column": 2 - } - } - }, - { - "type": "HTMLText", - "value": "Toggle", - "range": [ - 792, - 798 - ], - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 798, - 799 - ], - "loc": { - "start": { - "line": 46, - "column": 8 - }, - "end": { - "line": 46, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "dark", - "range": [ - 799, - 803 - ], - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 13 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 803, - 804 - ], - "loc": { - "start": { - "line": 46, - "column": 13 - }, - "end": { - "line": 46, - "column": 14 - } - } - }, - { - "type": "HTMLText", - "value": "mode", - "range": [ - 804, - 808 - ], - "loc": { - "start": { - "line": 46, - "column": 14 - }, - "end": { - "line": 46, - "column": 18 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 808, - 810 - ], - "loc": { - "start": { - "line": 46, - "column": 18 - }, - "end": { - "line": 47, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 810, - 811 - ], - "loc": { - "start": { - "line": 47, - "column": 1 - }, - "end": { - "line": 47, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 811, - 812 - ], - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 3 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 812, - 818 - ], - "loc": { - "start": { - "line": 47, - "column": 3 - }, - "end": { - "line": 47, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 818, - 819 - ], - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 10 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 819, - 820 - ], - "loc": { - "start": { - "line": 47, - "column": 10 - }, - "end": { - "line": 48, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 820, - 821 - ], - "loc": { - "start": { - "line": 48, - "column": 0 - }, - "end": { - "line": 48, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 821, - 822 - ], - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "div", - "range": [ - 822, - 825 - ], - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 825, - 826 - ], - "loc": { - "start": { - "line": 48, - "column": 5 - }, - "end": { - "line": 48, - "column": 6 - } - } - } - ], - "range": [ - 0, - 827 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 49, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json deleted file mode 100644 index 65a55407..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "theme", - "line": 4, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json deleted file mode 100644 index be2b1ddf..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/old-vs-new/06-autoscroll-scope-output.json +++ /dev/null @@ -1,6265 +0,0 @@ -{ - "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": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "tick", - "identifiers": [ - { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - ], - "defs": [ - { - "type": "ImportBinding", - "name": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "node": { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "local": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 254, - 258 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - } - ] - }, - { - "name": "theme", - "identifiers": [ - { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "'dark'", - "value": "dark", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 26 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 55, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - "range": [ - 47, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 27 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "theme", - "range": [ - 607, - 612 - ], - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - } - ] - }, - { - "name": "messages", - "identifiers": [ - { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrayExpression", - "elements": [], - "range": [ - 94, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 25 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 87, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 26 - } - } - }, - "range": [ - 76, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 26 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 134, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "from": "block", - "init": false, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 663, - 671 - ], - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 17 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - } - ] - }, - { - "name": "div", - "identifiers": [ - { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "init": null, - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 165, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 24 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 172, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 31 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 191, - 194 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 50 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 207, - 210 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 66 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 294, - 297 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - } - ] - }, - { - "name": "handleKeydown", - "identifiers": [ - { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "const", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - "init": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 417, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "range": [ - 411, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 424, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 411, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 404, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 34 - } - } - } - ], - "range": [ - 398, - 430 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 35 - } - } - }, - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "ReturnStatement", - "argument": null, - "range": [ - 445, - 452 - ], - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - "test": { - "type": "UnaryExpression", - "argument": { - "type": "Identifier", - "name": "text", - "range": [ - 439, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 438, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "range": [ - 434, - 452 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "operator": "=", - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "SpreadElement", - "argument": { - "type": "Identifier", - "name": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "range": [ - 469, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 15 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - { - "type": "Identifier", - "name": "text", - "range": [ - 482, - 486 - ], - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 32 - } - } - } - ], - "range": [ - 468, - 487 - ], - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - "range": [ - 457, - 487 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - "range": [ - 457, - 488 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 34 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 492, - 497 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 498, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 15 - } - } - }, - "range": [ - 492, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 15 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 505, - 510 - ], - "loc": { - "start": { - "line": 27, - "column": 16 - }, - "end": { - "line": 27, - "column": 21 - } - } - }, - "range": [ - 492, - 510 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 21 - } - } - }, - "operator": "=", - "right": { - "type": "Literal", - "raw": "''", - "value": "", - "range": [ - 513, - 515 - ], - "loc": { - "start": { - "line": 27, - "column": 24 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - "range": [ - 492, - 515 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - "range": [ - 492, - 516 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 27 - } - } - } - ], - "range": [ - 393, - 520 - ], - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 28, - "column": 3 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 370, - 375 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "key", - "range": [ - 376, - 379 - ], - "loc": { - "start": { - "line": 22, - "column": 12 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - "range": [ - 370, - 379 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - "operator": "===", - "right": { - "type": "Literal", - "raw": "'Enter'", - "value": "Enter", - "range": [ - 384, - 391 - ], - "loc": { - "start": { - "line": 22, - "column": 20 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "range": [ - 370, - 391 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "range": [ - 366, - 520 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - } - } - } - ], - "range": [ - 362, - 523 - ], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 29, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - ], - "range": [ - 332, - 523 - ], - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 29, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 743, - 756 - ], - "loc": { - "start": { - "line": 43, - "column": 20 - }, - "end": { - "line": 43, - "column": 33 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - } - } - ] - }, - { - "name": "toggle", - "identifiers": [ - { - "type": "Identifier", - "name": "toggle", - "range": [ - 535, - 541 - ], - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 16 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "toggle", - "range": [ - 535, - 541 - ], - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 548, - 559 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "operator": "=", - "right": { - "type": "UnaryExpression", - "argument": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 563, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 562, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 16 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "range": [ - 548, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "range": [ - 548, - 575 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 29 - } - } - } - ], - "range": [ - 544, - 578 - ], - "loc": { - "start": { - "line": 31, - "column": 19 - }, - "end": { - "line": 33, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "toggle", - "range": [ - 535, - 541 - ], - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - "params": [], - "range": [ - 526, - 578 - ], - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 33, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "toggle", - "range": [ - 781, - 787 - ], - "loc": { - "start": { - "line": 45, - "column": 19 - }, - "end": { - "line": 45, - "column": 25 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "toggle", - "range": [ - 535, - 541 - ], - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 16 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "theme", - "range": [ - 607, - 612 - ], - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "theme", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "viewport", - "range": [ - 643, - 651 - ], - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 663, - 671 - ], - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 17 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 743, - 756 - ], - "loc": { - "start": { - "line": 43, - "column": 20 - }, - "end": { - "line": 43, - "column": 33 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "toggle", - "range": [ - 781, - 787 - ], - "loc": { - "start": { - "line": 45, - "column": 19 - }, - "end": { - "line": 45, - "column": 25 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "toggle", - "range": [ - 535, - 541 - ], - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 16 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "autoscroll", - "identifiers": [ - { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - "init": { - "type": "LogicalExpression", - "left": { - "type": "Identifier", - "name": "div", - "range": [ - 165, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 24 - } - } - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "left": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 172, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 31 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "offsetHeight", - "range": [ - 176, - 188 - ], - "loc": { - "start": { - "line": 11, - "column": 32 - }, - "end": { - "line": 11, - "column": 44 - } - } - }, - "range": [ - 172, - 188 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 44 - } - } - }, - "operator": "+", - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 191, - 194 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 50 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollTop", - "range": [ - 195, - 204 - ], - "loc": { - "start": { - "line": 11, - "column": 51 - }, - "end": { - "line": 11, - "column": 60 - } - } - }, - "range": [ - 191, - 204 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 60 - } - } - }, - "range": [ - 172, - 204 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 60 - } - } - }, - "operator": ">", - "right": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 207, - 210 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 66 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollHeight", - "range": [ - 211, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 67 - }, - "end": { - "line": 11, - "column": 79 - } - } - }, - "range": [ - 207, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 79 - } - } - }, - "operator": "-", - "right": { - "type": "Literal", - "raw": "50", - "value": 50, - "range": [ - 226, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 82 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 207, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 172, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 165, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 84 - } - } - }, - "range": [ - 152, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 84 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 237, - 247 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 134, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 165, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 24 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 172, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 31 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 191, - 194 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 50 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 207, - 210 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 66 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 237, - 247 - ], - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "autoscroll", - "range": [ - 152, - 162 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 18 - } - } - } - } - ], - "childScopes": [ - { - "type": "block", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 254, - 258 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 294, - 297 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 294, - 297 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 254, - 258 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 294, - 297 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 134, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 165, - 168 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 24 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 172, - 175 - ], - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 31 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 191, - 194 - ], - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 50 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 207, - 210 - ], - "loc": { - "start": { - "line": 11, - "column": 63 - }, - "end": { - "line": 11, - "column": 66 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 254, - 258 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 294, - 297 - ], - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 105, - 108 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "event", - "identifiers": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "const", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - "init": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 417, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "range": [ - 411, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 424, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 411, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 404, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 34 - } - } - } - ], - "range": [ - 398, - 430 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 35 - } - } - }, - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "ReturnStatement", - "argument": null, - "range": [ - 445, - 452 - ], - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - "test": { - "type": "UnaryExpression", - "argument": { - "type": "Identifier", - "name": "text", - "range": [ - 439, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 438, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "range": [ - 434, - 452 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "operator": "=", - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "SpreadElement", - "argument": { - "type": "Identifier", - "name": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "range": [ - 469, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 15 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - { - "type": "Identifier", - "name": "text", - "range": [ - 482, - 486 - ], - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 32 - } - } - } - ], - "range": [ - 468, - 487 - ], - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - "range": [ - 457, - 487 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - "range": [ - 457, - 488 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 34 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 492, - 497 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 498, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 15 - } - } - }, - "range": [ - 492, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 15 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 505, - 510 - ], - "loc": { - "start": { - "line": 27, - "column": 16 - }, - "end": { - "line": 27, - "column": 21 - } - } - }, - "range": [ - 492, - 510 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 21 - } - } - }, - "operator": "=", - "right": { - "type": "Literal", - "raw": "''", - "value": "", - "range": [ - 513, - 515 - ], - "loc": { - "start": { - "line": 27, - "column": 24 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - "range": [ - 492, - 515 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - "range": [ - 492, - 516 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 27 - } - } - } - ], - "range": [ - 393, - 520 - ], - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 28, - "column": 3 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 370, - 375 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "key", - "range": [ - 376, - 379 - ], - "loc": { - "start": { - "line": 22, - "column": 12 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - "range": [ - 370, - 379 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - "operator": "===", - "right": { - "type": "Literal", - "raw": "'Enter'", - "value": "Enter", - "range": [ - 384, - 391 - ], - "loc": { - "start": { - "line": 22, - "column": 20 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "range": [ - 370, - 391 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "range": [ - 366, - 520 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - } - } - } - ], - "range": [ - 362, - 523 - ], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 29, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "handleKeydown", - "range": [ - 341, - 354 - ], - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - ], - "range": [ - 332, - 523 - ], - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 29, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 370, - 375 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 492, - 497 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 370, - 375 - ], - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - } - ], - "childScopes": [ - { - "type": "block", - "variables": [ - { - "name": "text", - "identifiers": [ - { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - "init": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "target", - "range": [ - 417, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "range": [ - 411, - 423 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "value", - "range": [ - 424, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 411, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 34 - } - } - }, - "range": [ - 404, - 429 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 34 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - "from": "block", - "init": true, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 439, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 482, - 486 - ], - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 32 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - "from": "block", - "init": true, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 439, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "from": "block", - "init": false, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "text", - "range": [ - 482, - 486 - ], - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 32 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "text", - "range": [ - 404, - 408 - ], - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 492, - 497 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 411, - 416 - ], - "loc": { - "start": { - "line": 23, - "column": 16 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "from": "block", - "init": false, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "event", - "range": [ - 492, - 497 - ], - "loc": { - "start": { - "line": 27, - "column": 3 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "event", - "range": [ - 355, - 360 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 29 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 11 - } - } - }, - "from": "block", - "init": false, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 472, - 480 - ], - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 76, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 548, - 559 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "from": "function", - "init": false, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 563, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 548, - 559 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "from": "function", - "init": false, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 563, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "message", - "identifiers": [ - { - "type": "Identifier", - "name": "message", - "range": [ - 675, - 682 - ], - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 28 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "message", - "range": [ - 675, - 682 - ], - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 28 - } - } - }, - "node": { - "type": "SvelteEachBlock", - "expression": { - "type": "Identifier", - "name": "messages", - "range": [ - 663, - 671 - ], - "loc": { - "start": { - "line": 38, - "column": 9 - }, - "end": { - "line": 38, - "column": 17 - } - } - }, - "context": { - "type": "Identifier", - "name": "message", - "range": [ - 675, - 682 - ], - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 28 - } - } - }, - "index": null, - "key": null, - "children": [ - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 688, - 689 - ], - "loc": { - "start": { - "line": 39, - "column": 4 - }, - "end": { - "line": 39, - "column": 5 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 687, - 690 - ], - "loc": { - "start": { - "line": 39, - "column": 3 - }, - "end": { - "line": 39, - "column": 6 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "message", - "range": [ - 691, - 698 - ], - "loc": { - "start": { - "line": 39, - "column": 7 - }, - "end": { - "line": 39, - "column": 14 - } - } - }, - "range": [ - 690, - 699 - ], - "loc": { - "start": { - "line": 39, - "column": 6 - }, - "end": { - "line": 39, - "column": 15 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 699, - 703 - ], - "loc": { - "start": { - "line": 39, - "column": 15 - }, - "end": { - "line": 39, - "column": 19 - } - } - }, - "range": [ - 687, - 703 - ], - "loc": { - "start": { - "line": 39, - "column": 3 - }, - "end": { - "line": 39, - "column": 19 - } - } - } - ], - "else": null, - "range": [ - 656, - 713 - ], - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 40, - "column": 9 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "message", - "range": [ - 691, - 698 - ], - "loc": { - "start": { - "line": 39, - "column": 7 - }, - "end": { - "line": 39, - "column": 14 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "message", - "range": [ - 675, - 682 - ], - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 28 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "message", - "range": [ - 691, - 698 - ], - "loc": { - "start": { - "line": 39, - "column": 7 - }, - "end": { - "line": 39, - "column": 14 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "message", - "range": [ - 675, - 682 - ], - "loc": { - "start": { - "line": 38, - "column": 21 - }, - "end": { - "line": 38, - "column": 28 - } - } - } - } - ], - "childScopes": [], - "through": [] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 548, - 559 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "from": "function", - "init": false, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 563, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "viewport", - "range": [ - 643, - 651 - ], - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 548, - 559 - ], - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 13 - } - } - }, - "from": "function", - "init": false, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "toggleValue", - "range": [ - 563, - 574 - ], - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "viewport", - "range": [ - 643, - 651 - ], - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte deleted file mode 100644 index 0b5ebf4a..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-input.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json deleted file mode 100644 index cfba0680..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-output.json +++ /dev/null @@ -1,1224 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteScriptElement", - "name": { - "type": "SvelteName", - "name": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 10, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 33, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "range": [ - 0, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 42, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 5, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 45, - 51 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 52, - 60 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 68, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 68, - 75 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 62, - 75 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - "range": [ - 52, - 76 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 32 - } - } - } - ], - "selfClosing": false, - "range": [ - 44, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\tclicks: ", - "range": [ - 77, - 87 - ], - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "count", - "range": [ - 88, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 15 - } - } - }, - "range": [ - 87, - 94 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 7, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 95, - 104 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - "range": [ - 44, - 104 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 7, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 35, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 42, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 5, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 45, - 51 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 52, - 54 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 65, - 67 - ], - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 68, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 73, - 75 - ], - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 75, - 76 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 76, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 32 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 77, - 79 - ], - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - { - "type": "HTMLText", - "value": "clicks:", - "range": [ - 79, - 86 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 86, - 87 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 87, - 88 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 88, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 93, - 94 - ], - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 7, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 97, - 103 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 103, - 104 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - } - ], - "range": [ - 0, - 105 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json deleted file mode 100644 index 49fb45fa..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/01-$state-scope-output.json +++ /dev/null @@ -1,561 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$$slots", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$props", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$restProps", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 68, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 88, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 88, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 68, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 68, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte deleted file mode 100644 index 7935359b..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-input.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - - -

{count} doubled is {double}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json deleted file mode 100644 index b34140e1..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-output.json +++ /dev/null @@ -1,2040 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteScriptElement", - "name": { - "type": "SvelteName", - "name": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 10, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - "range": [ - 56, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 47, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - "range": [ - 38, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 33 - } - } - } - ], - "range": [ - 34, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 34 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 68, - 77 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - "range": [ - 0, - 77 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 77, - 79 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 6, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 80, - 86 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 90, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 87, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 103, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 29 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 103, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 31 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 97, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 6, - "column": 31 - } - } - }, - "range": [ - 87, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 32 - } - } - } - ], - "selfClosing": false, - "range": [ - 79, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 33 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 112, - 114 - ], - "loc": { - "start": { - "line": 6, - "column": 33 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "double", - "range": [ - 115, - 121 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "range": [ - 114, - 122 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 122, - 123 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 8, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 123, - 132 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - "range": [ - 79, - 132 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 132, - 134 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 10, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 135, - 136 - ], - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 134, - 137 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "count", - "range": [ - 138, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "range": [ - 137, - 144 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "SvelteText", - "value": " doubled is ", - "range": [ - 144, - 156 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 22 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "double", - "range": [ - 157, - 163 - ], - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "range": [ - 156, - 164 - ], - "loc": { - "start": { - "line": 10, - "column": 22 - }, - "end": { - "line": 10, - "column": 30 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 164, - 168 - ], - "loc": { - "start": { - "line": 10, - "column": 30 - }, - "end": { - "line": 10, - "column": 34 - } - } - }, - "range": [ - 134, - 168 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 34 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 3, - "column": 29 - }, - "end": { - "line": 3, - "column": 30 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 70, - 76 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 76, - 77 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 77, - 79 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 6, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 80, - 86 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 87, - 89 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 89, - 90 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 90, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 97, - 98 - ], - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 100, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 103, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 108, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 29 - }, - "end": { - "line": 6, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 31 - }, - "end": { - "line": 6, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 111, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 32 - }, - "end": { - "line": 6, - "column": 33 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 112, - 114 - ], - "loc": { - "start": { - "line": 6, - "column": 33 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 114, - 115 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 115, - 121 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 121, - 122 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 122, - 123 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 8, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 124, - 125 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 125, - 131 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 131, - 132 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 132, - 134 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 10, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 134, - 135 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 135, - 136 - ], - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 137, - 138 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 138, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 143, - 144 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 144, - 145 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - { - "type": "HTMLText", - "value": "doubled", - "range": [ - 145, - 152 - ], - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 18 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 152, - 153 - ], - "loc": { - "start": { - "line": 10, - "column": 18 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - { - "type": "HTMLText", - "value": "is", - "range": [ - 153, - 155 - ], - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 21 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 155, - 156 - ], - "loc": { - "start": { - "line": 10, - "column": 21 - }, - "end": { - "line": 10, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 156, - 157 - ], - "loc": { - "start": { - "line": 10, - "column": 22 - }, - "end": { - "line": 10, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 157, - 163 - ], - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 163, - 164 - ], - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 164, - 165 - ], - "loc": { - "start": { - "line": 10, - "column": 30 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 165, - 166 - ], - "loc": { - "start": { - "line": 10, - "column": 31 - }, - "end": { - "line": 10, - "column": 32 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 166, - 167 - ], - "loc": { - "start": { - "line": 10, - "column": 32 - }, - "end": { - "line": 10, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 10, - "column": 33 - }, - "end": { - "line": 10, - "column": 34 - } - } - } - ], - "range": [ - 0, - 169 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 11, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json deleted file mode 100644 index ce8533a2..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "double", - "line": 3, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json deleted file mode 100644 index d0aede02..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/02-$derived-scope-output.json +++ /dev/null @@ -1,1127 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$$slots", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$props", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$restProps", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 103, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 138, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "name": "double", - "identifiers": [ - { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - "range": [ - 56, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 47, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - "range": [ - 38, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 33 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 115, - 121 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 157, - 163 - ], - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 115, - 121 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 138, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 157, - 163 - ], - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 103, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 103, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte deleted file mode 100644 index 5a2b2931..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-input.svelte +++ /dev/null @@ -1,24 +0,0 @@ - - - - -

{count} doubled is {double}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json deleted file mode 100644 index 73770948..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-output.json +++ /dev/null @@ -1,3251 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteScriptElement", - "name": { - "type": "SvelteName", - "name": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 10, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - "range": [ - 56, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 47, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - "range": [ - 38, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 33 - } - } - } - ], - "range": [ - 34, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 231, - 236 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "count", - "range": [ - 231, - 236 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "range": [ - 231, - 236 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "double", - "range": [ - 238, - 244 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "double", - "range": [ - 238, - 244 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "range": [ - 238, - 244 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 29 - } - } - } - ], - "range": [ - 229, - 246 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 31 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "console", - "range": [ - 217, - 224 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "log", - "range": [ - 225, - 228 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - "range": [ - 217, - 228 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - "optional": false, - "range": [ - 217, - 247 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 32 - } - } - }, - "range": [ - 217, - 248 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 33 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "'cleanup'", - "value": "cleanup", - "range": [ - 415, - 424 - ], - "loc": { - "start": { - "line": 15, - "column": 15 - }, - "end": { - "line": 15, - "column": 24 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "console", - "range": [ - 403, - 410 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "log", - "range": [ - 411, - 414 - ], - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "range": [ - 403, - 414 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "optional": false, - "range": [ - 403, - 425 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 25 - } - } - }, - "range": [ - 403, - 426 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 26 - } - } - } - ], - "range": [ - 265, - 430 - ], - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 16, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 259, - 430 - ], - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 16, - "column": 3 - } - } - }, - "range": [ - 252, - 431 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 16, - "column": 4 - } - } - } - ], - "range": [ - 84, - 434 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 78, - 434 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 17, - "column": 2 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "optional": false, - "range": [ - 70, - 435 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 17, - "column": 3 - } - } - }, - "range": [ - 70, - 436 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 17, - "column": 4 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 437, - 446 - ], - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 18, - "column": 9 - } - } - }, - "range": [ - 0, - 446 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 18, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 446, - 448 - ], - "loc": { - "start": { - "line": 18, - "column": 9 - }, - "end": { - "line": 20, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 449, - 455 - ], - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 20, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 459, - 464 - ], - "loc": { - "start": { - "line": 20, - "column": 11 - }, - "end": { - "line": 20, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 456, - 464 - ], - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 472, - 477 - ], - "loc": { - "start": { - "line": 20, - "column": 24 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 472, - 479 - ], - "loc": { - "start": { - "line": 20, - "column": 24 - }, - "end": { - "line": 20, - "column": 31 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 466, - 479 - ], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 31 - } - } - }, - "range": [ - 456, - 480 - ], - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 32 - } - } - } - ], - "selfClosing": false, - "range": [ - 448, - 481 - ], - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 33 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 481, - 483 - ], - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 21, - "column": 1 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "double", - "range": [ - 484, - 490 - ], - "loc": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - "range": [ - 483, - 491 - ], - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 491, - 492 - ], - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 22, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 492, - 501 - ], - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - "range": [ - 448, - 501 - ], - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 501, - 503 - ], - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 24, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 504, - 505 - ], - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 2 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 503, - 506 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 3 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "count", - "range": [ - 507, - 512 - ], - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - "range": [ - 506, - 513 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - { - "type": "SvelteText", - "value": " doubled is ", - "range": [ - 513, - 525 - ], - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "double", - "range": [ - 526, - 532 - ], - "loc": { - "start": { - "line": 24, - "column": 23 - }, - "end": { - "line": 24, - "column": 29 - } - } - }, - "range": [ - 525, - 533 - ], - "loc": { - "start": { - "line": 24, - "column": 22 - }, - "end": { - "line": 24, - "column": 30 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 533, - 537 - ], - "loc": { - "start": { - "line": 24, - "column": 30 - }, - "end": { - "line": 24, - "column": 34 - } - } - }, - "range": [ - 503, - 537 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 34 - } - } - } - ], - "sourceType": "module", - "comments": [ - { - "type": "Line", - "value": " runs when the component is mounted, and again", - "range": [ - 88, - 136 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 50 - } - } - }, - { - "type": "Line", - "value": " whenever `count` or `double` change,", - "range": [ - 139, - 178 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 41 - } - } - }, - { - "type": "Line", - "value": " after the DOM has been updated", - "range": [ - 181, - 214 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 35 - } - } - }, - { - "type": "Line", - "value": " if a callback is provided, it will run", - "range": [ - 270, - 311 - ], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 44 - } - } - }, - { - "type": "Line", - "value": " a) immediately before the effect re-runs", - "range": [ - 315, - 358 - ], - "loc": { - "start": { - "line": 13, - "column": 3 - }, - "end": { - "line": 13, - "column": 46 - } - } - }, - { - "type": "Line", - "value": " b) when the component is destroyed", - "range": [ - 362, - 399 - ], - "loc": { - "start": { - "line": 14, - "column": 3 - }, - "end": { - "line": 14, - "column": 40 - } - } - } - ], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 3, - "column": 29 - }, - "end": { - "line": 3, - "column": 30 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 32 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 77, - 78 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 81, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 84, - 85 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "console", - "range": [ - 217, - 224 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 224, - 225 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "log", - "range": [ - 225, - 228 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 228, - 229 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 229, - 230 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 231, - 236 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 236, - 237 - ], - "loc": { - "start": { - "line": 9, - "column": 21 - }, - "end": { - "line": 9, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 238, - 244 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 245, - 246 - ], - "loc": { - "start": { - "line": 9, - "column": 30 - }, - "end": { - "line": 9, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 246, - 247 - ], - "loc": { - "start": { - "line": 9, - "column": 31 - }, - "end": { - "line": 9, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 247, - 248 - ], - "loc": { - "start": { - "line": 9, - "column": 32 - }, - "end": { - "line": 9, - "column": 33 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 252, - 258 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 259, - 260 - ], - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 260, - 261 - ], - "loc": { - "start": { - "line": 11, - "column": 10 - }, - "end": { - "line": 11, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 262, - 264 - ], - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "console", - "range": [ - 403, - 410 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 410, - 411 - ], - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "log", - "range": [ - 411, - 414 - ], - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 414, - 415 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 15 - } - } - }, - { - "type": "String", - "value": "'cleanup'", - "range": [ - 415, - 424 - ], - "loc": { - "start": { - "line": 15, - "column": 15 - }, - "end": { - "line": 15, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 424, - 425 - ], - "loc": { - "start": { - "line": 15, - "column": 24 - }, - "end": { - "line": 15, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 425, - 426 - ], - "loc": { - "start": { - "line": 15, - "column": 25 - }, - "end": { - "line": 15, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 429, - 430 - ], - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 16, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 430, - 431 - ], - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 433, - 434 - ], - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 17, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 434, - 435 - ], - "loc": { - "start": { - "line": 17, - "column": 2 - }, - "end": { - "line": 17, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 435, - 436 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 437, - 438 - ], - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 18, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 438, - 439 - ], - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 439, - 445 - ], - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 445, - 446 - ], - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 446, - 448 - ], - "loc": { - "start": { - "line": 18, - "column": 9 - }, - "end": { - "line": 20, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 448, - 449 - ], - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 449, - 455 - ], - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 20, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 456, - 458 - ], - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 458, - 459 - ], - "loc": { - "start": { - "line": 20, - "column": 10 - }, - "end": { - "line": 20, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 459, - 464 - ], - "loc": { - "start": { - "line": 20, - "column": 11 - }, - "end": { - "line": 20, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 464, - 465 - ], - "loc": { - "start": { - "line": 20, - "column": 16 - }, - "end": { - "line": 20, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 465, - 466 - ], - "loc": { - "start": { - "line": 20, - "column": 17 - }, - "end": { - "line": 20, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 466, - 467 - ], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 467, - 468 - ], - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 469, - 471 - ], - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 472, - 477 - ], - "loc": { - "start": { - "line": 20, - "column": 24 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 477, - 479 - ], - "loc": { - "start": { - "line": 20, - "column": 29 - }, - "end": { - "line": 20, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 479, - 480 - ], - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 480, - 481 - ], - "loc": { - "start": { - "line": 20, - "column": 32 - }, - "end": { - "line": 20, - "column": 33 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 481, - 483 - ], - "loc": { - "start": { - "line": 20, - "column": 33 - }, - "end": { - "line": 21, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 483, - 484 - ], - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 484, - 490 - ], - "loc": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 490, - 491 - ], - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 21, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 491, - 492 - ], - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 22, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 492, - 493 - ], - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 493, - 494 - ], - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 494, - 500 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 500, - 501 - ], - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 501, - 503 - ], - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 24, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 503, - 504 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 504, - 505 - ], - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 505, - 506 - ], - "loc": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 24, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 506, - 507 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 507, - 512 - ], - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 512, - 513 - ], - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 513, - 514 - ], - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 11 - } - } - }, - { - "type": "HTMLText", - "value": "doubled", - "range": [ - 514, - 521 - ], - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 18 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 521, - 522 - ], - "loc": { - "start": { - "line": 24, - "column": 18 - }, - "end": { - "line": 24, - "column": 19 - } - } - }, - { - "type": "HTMLText", - "value": "is", - "range": [ - 522, - 524 - ], - "loc": { - "start": { - "line": 24, - "column": 19 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 524, - 525 - ], - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 525, - 526 - ], - "loc": { - "start": { - "line": 24, - "column": 22 - }, - "end": { - "line": 24, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 526, - 532 - ], - "loc": { - "start": { - "line": 24, - "column": 23 - }, - "end": { - "line": 24, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 532, - 533 - ], - "loc": { - "start": { - "line": 24, - "column": 29 - }, - "end": { - "line": 24, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 533, - 534 - ], - "loc": { - "start": { - "line": 24, - "column": 30 - }, - "end": { - "line": 24, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 534, - 535 - ], - "loc": { - "start": { - "line": 24, - "column": 31 - }, - "end": { - "line": 24, - "column": 32 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 535, - 536 - ], - "loc": { - "start": { - "line": 24, - "column": 32 - }, - "end": { - "line": 24, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 536, - 537 - ], - "loc": { - "start": { - "line": 24, - "column": 33 - }, - "end": { - "line": 24, - "column": 34 - } - } - } - ], - "range": [ - 0, - 538 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 25, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json deleted file mode 100644 index ce8533a2..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "double", - "line": 3, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json deleted file mode 100644 index 683ea63d..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/03-$effect-scope-output.json +++ /dev/null @@ -1,1664 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$$slots", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$props", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$restProps", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 231, - 236 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 472, - 477 - ], - "loc": { - "start": { - "line": 20, - "column": 24 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 507, - 512 - ], - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "name": "double", - "identifiers": [ - { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - "range": [ - 56, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 47, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - "range": [ - 38, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 33 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 238, - 244 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 484, - 490 - ], - "loc": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 526, - 532 - ], - "loc": { - "start": { - "line": 24, - "column": 23 - }, - "end": { - "line": 24, - "column": 29 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 484, - 490 - ], - "loc": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 507, - 512 - ], - "loc": { - "start": { - "line": 24, - "column": 4 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 526, - 532 - ], - "loc": { - "start": { - "line": 24, - "column": 23 - }, - "end": { - "line": 24, - "column": 29 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 217, - 224 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 231, - 236 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 238, - 244 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 403, - 410 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 403, - 410 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 217, - 224 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 231, - 236 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 238, - 244 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 403, - 410 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - }, - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 472, - 477 - ], - "loc": { - "start": { - "line": 20, - "column": 24 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 472, - 477 - ], - "loc": { - "start": { - "line": 20, - "column": 24 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 47, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 70, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 217, - 224 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 403, - 410 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 217, - 224 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "console", - "range": [ - 403, - 410 - ], - "loc": { - "start": { - "line": 15, - "column": 3 - }, - "end": { - "line": 15, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte deleted file mode 100644 index 8ed4e55f..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-input.svelte +++ /dev/null @@ -1,28 +0,0 @@ - - -
- {#each messages as message} -

{message}

- {/each} -
diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json deleted file mode 100644 index ff6ad292..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-no-unused-expressions-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-unused-expressions", - "code": "messages;", - "line": 13, - "column": 3 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json deleted file mode 100644 index aa092cde..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-output.json +++ /dev/null @@ -1,3771 +0,0 @@ -{ - "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": "ImportDeclaration", - "source": { - "type": "Literal", - "raw": "'svelte'", - "value": "svelte", - "range": [ - 31, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - "specifiers": [ - { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "local": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - ], - "range": [ - 10, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "init": null, - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - ], - "range": [ - 43, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "init": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 68, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - "range": [ - 57, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 18 - } - } - } - ], - "range": [ - 53, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "ReturnStatement", - "argument": null, - "range": [ - 115, - 122 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - "test": { - "type": "UnaryExpression", - "argument": { - "type": "Identifier", - "name": "div", - "range": [ - 110, - 113 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "operator": "!", - "prefix": true, - "range": [ - 109, - 113 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "range": [ - 105, - 122 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "messages", - "range": [ - 217, - 225 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "range": [ - 217, - 226 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": "IfStatement", - "alternate": null, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 378, - 379 - ], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 18 - } - } - }, - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 381, - 384 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollHeight", - "range": [ - 385, - 397 - ], - "loc": { - "start": { - "line": 18, - "column": 24 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - "range": [ - 381, - 397 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 36 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 365, - 368 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollTo", - "range": [ - 369, - 377 - ], - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 16 - } - } - }, - "range": [ - 365, - 377 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 16 - } - } - }, - "optional": false, - "range": [ - 365, - 398 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, - "range": [ - 365, - 399 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 38 - } - } - } - ], - "range": [ - 359, - 404 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 19, - "column": 4 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 353, - 404 - ], - "loc": { - "start": { - "line": 17, - "column": 15 - }, - "end": { - "line": 19, - "column": 4 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "tick", - "range": [ - 341, - 345 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 7 - } - } - }, - "optional": false, - "range": [ - 341, - 347 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "then", - "range": [ - 348, - 352 - ], - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, - "range": [ - 341, - 352 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, - "optional": false, - "range": [ - 341, - 405 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 19, - "column": 5 - } - } - }, - "range": [ - 341, - 406 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 19, - "column": 6 - } - } - } - ], - "range": [ - 336, - 410 - ], - "loc": { - "start": { - "line": 16, - "column": 64 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, - "test": { - "type": "BinaryExpression", - "left": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "offsetHeight", - "range": [ - 282, - 294 - ], - "loc": { - "start": { - "line": 16, - "column": 10 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "range": [ - 278, - 294 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - "operator": "+", - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 297, - 300 - ], - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollTop", - "range": [ - 301, - 310 - ], - "loc": { - "start": { - "line": 16, - "column": 29 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "range": [ - 297, - 310 - ], - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "range": [ - 278, - 310 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - "operator": ">", - "right": { - "type": "BinaryExpression", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "div", - "range": [ - 313, - 316 - ], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 44 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "scrollHeight", - "range": [ - 317, - 329 - ], - "loc": { - "start": { - "line": 16, - "column": 45 - }, - "end": { - "line": 16, - "column": 57 - } - } - }, - "range": [ - 313, - 329 - ], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 57 - } - } - }, - "operator": "-", - "right": { - "type": "Literal", - "raw": "20", - "value": 20, - "range": [ - 332, - 334 - ], - "loc": { - "start": { - "line": 16, - "column": 60 - }, - "end": { - "line": 16, - "column": 62 - } - } - }, - "range": [ - 313, - 334 - ], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 62 - } - } - }, - "range": [ - 278, - 334 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 62 - } - } - }, - "range": [ - 274, - 410 - ], - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 20, - "column": 3 - } - } - } - ], - "range": [ - 101, - 413 - ], - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 21, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 95, - 413 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 21, - "column": 2 - } - } - } - ], - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "$effect", - "range": [ - 83, - 90 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "pre", - "range": [ - 91, - 94 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - "range": [ - 83, - 94 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - "optional": false, - "range": [ - 83, - 414 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 21, - "column": 3 - } - } - }, - "range": [ - 83, - 415 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 21, - "column": 4 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 416, - 425 - ], - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - "range": [ - 0, - 425 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 425, - 427 - ], - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 24, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "div", - "range": [ - 428, - 431 - ], - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "Binding", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "this", - "range": [ - 437, - 441 - ], - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 14 - } - } - }, - "modifiers": [], - "range": [ - 432, - 441 - ], - "loc": { - "start": { - "line": 24, - "column": 5 - }, - "end": { - "line": 24, - "column": 14 - } - } - }, - "expression": { - "type": "Identifier", - "name": "div", - "range": [ - 443, - 446 - ], - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 19 - } - } - }, - "shorthand": false, - "range": [ - 432, - 447 - ], - "loc": { - "start": { - "line": 24, - "column": 5 - }, - "end": { - "line": 24, - "column": 20 - } - } - } - ], - "selfClosing": false, - "range": [ - 427, - 448 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 448, - 450 - ], - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 25, - "column": 1 - } - } - }, - { - "type": "SvelteEachBlock", - "expression": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - "context": { - "type": "Identifier", - "name": "message", - "range": [ - 469, - 476 - ], - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 27 - } - } - }, - "index": null, - "key": null, - "children": [ - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 481, - 482 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 4 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 480, - 483 - ], - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 5 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "message", - "range": [ - 484, - 491 - ], - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 13 - } - } - }, - "range": [ - 483, - 492 - ], - "loc": { - "start": { - "line": 26, - "column": 5 - }, - "end": { - "line": 26, - "column": 14 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 492, - 496 - ], - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 18 - } - } - }, - "range": [ - 480, - 496 - ], - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 18 - } - } - } - ], - "else": null, - "range": [ - 450, - 505 - ], - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 505, - 506 - ], - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 28, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 506, - 512 - ], - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 6 - } - } - }, - "range": [ - 427, - 512 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 28, - "column": 6 - } - } - } - ], - "sourceType": "module", - "comments": [ - { - "type": "Line", - "value": " ...", - "range": [ - 74, - 80 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 7 - } - } - }, - { - "type": "Line", - "value": " not yet mounted", - "range": [ - 123, - 141 - ], - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 38 - } - } - }, - { - "type": "Line", - "value": " reference `messages` so that this code re-runs whenever it changes", - "range": [ - 145, - 214 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 71 - } - } - }, - { - "type": "Line", - "value": " autoscroll when new messages are added", - "range": [ - 230, - 271 - ], - "loc": { - "start": { - "line": 15, - "column": 2 - }, - "end": { - "line": 15, - "column": 43 - } - } - } - ], - "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": "import", - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "from", - "range": [ - 26, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "String", - "value": "'svelte'", - "range": [ - 31, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 53, - 56 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "$effect", - "range": [ - 83, - 90 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 90, - 91 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "pre", - "range": [ - 91, - 94 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 98, - 100 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 101, - 102 - ], - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "if", - "range": [ - 105, - 107 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 108, - 109 - ], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "!", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 110, - 113 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 113, - 114 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 115, - 121 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 121, - 122 - ], - "loc": { - "start": { - "line": 10, - "column": 18 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 217, - 225 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 225, - 226 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "if", - "range": [ - 274, - 276 - ], - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 16, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 277, - 278 - ], - "loc": { - "start": { - "line": 16, - "column": 5 - }, - "end": { - "line": 16, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "offsetHeight", - "range": [ - 282, - 294 - ], - "loc": { - "start": { - "line": 16, - "column": 10 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 295, - 296 - ], - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 297, - 300 - ], - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 300, - 301 - ], - "loc": { - "start": { - "line": 16, - "column": 28 - }, - "end": { - "line": 16, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "scrollTop", - "range": [ - 301, - 310 - ], - "loc": { - "start": { - "line": 16, - "column": 29 - }, - "end": { - "line": 16, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 311, - 312 - ], - "loc": { - "start": { - "line": 16, - "column": 39 - }, - "end": { - "line": 16, - "column": 40 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 313, - 316 - ], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 44 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 316, - 317 - ], - "loc": { - "start": { - "line": 16, - "column": 44 - }, - "end": { - "line": 16, - "column": 45 - } - } - }, - { - "type": "Identifier", - "value": "scrollHeight", - "range": [ - 317, - 329 - ], - "loc": { - "start": { - "line": 16, - "column": 45 - }, - "end": { - "line": 16, - "column": 57 - } - } - }, - { - "type": "Punctuator", - "value": "-", - "range": [ - 330, - 331 - ], - "loc": { - "start": { - "line": 16, - "column": 58 - }, - "end": { - "line": 16, - "column": 59 - } - } - }, - { - "type": "Numeric", - "value": "20", - "range": [ - 332, - 334 - ], - "loc": { - "start": { - "line": 16, - "column": 60 - }, - "end": { - "line": 16, - "column": 62 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 334, - 335 - ], - "loc": { - "start": { - "line": 16, - "column": 62 - }, - "end": { - "line": 16, - "column": 63 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 336, - 337 - ], - "loc": { - "start": { - "line": 16, - "column": 64 - }, - "end": { - "line": 16, - "column": 65 - } - } - }, - { - "type": "Identifier", - "value": "tick", - "range": [ - 341, - 345 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 345, - 346 - ], - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 346, - 347 - ], - "loc": { - "start": { - "line": 17, - "column": 8 - }, - "end": { - "line": 17, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 347, - 348 - ], - "loc": { - "start": { - "line": 17, - "column": 9 - }, - "end": { - "line": 17, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "then", - "range": [ - 348, - 352 - ], - "loc": { - "start": { - "line": 17, - "column": 10 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 352, - 353 - ], - "loc": { - "start": { - "line": 17, - "column": 14 - }, - "end": { - "line": 17, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 353, - 354 - ], - "loc": { - "start": { - "line": 17, - "column": 15 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 354, - 355 - ], - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 356, - 358 - ], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 359, - 360 - ], - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 365, - 368 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 368, - 369 - ], - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "scrollTo", - "range": [ - 369, - 377 - ], - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 377, - 378 - ], - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 17 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 378, - 379 - ], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 379, - 380 - ], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 381, - 384 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 384, - 385 - ], - "loc": { - "start": { - "line": 18, - "column": 23 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "scrollHeight", - "range": [ - 385, - 397 - ], - "loc": { - "start": { - "line": 18, - "column": 24 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 397, - 398 - ], - "loc": { - "start": { - "line": 18, - "column": 36 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 398, - 399 - ], - "loc": { - "start": { - "line": 18, - "column": 37 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 403, - 404 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 404, - 405 - ], - "loc": { - "start": { - "line": 19, - "column": 4 - }, - "end": { - "line": 19, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 405, - 406 - ], - "loc": { - "start": { - "line": 19, - "column": 5 - }, - "end": { - "line": 19, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 409, - 410 - ], - "loc": { - "start": { - "line": 20, - "column": 2 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 412, - 413 - ], - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 413, - 414 - ], - "loc": { - "start": { - "line": 21, - "column": 2 - }, - "end": { - "line": 21, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 414, - 415 - ], - "loc": { - "start": { - "line": 21, - "column": 3 - }, - "end": { - "line": 21, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 416, - 417 - ], - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 417, - 418 - ], - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 418, - 424 - ], - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 424, - 425 - ], - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 425, - 427 - ], - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 24, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 427, - 428 - ], - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "div", - "range": [ - 428, - 431 - ], - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "bind", - "range": [ - 432, - 436 - ], - "loc": { - "start": { - "line": 24, - "column": 5 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 436, - 437 - ], - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "this", - "range": [ - 437, - 441 - ], - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 441, - 442 - ], - "loc": { - "start": { - "line": 24, - "column": 14 - }, - "end": { - "line": 24, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 442, - 443 - ], - "loc": { - "start": { - "line": 24, - "column": 15 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "div", - "range": [ - 443, - 446 - ], - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 446, - 447 - ], - "loc": { - "start": { - "line": 24, - "column": 19 - }, - "end": { - "line": 24, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 447, - 448 - ], - "loc": { - "start": { - "line": 24, - "column": 20 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 448, - 450 - ], - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 25, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 450, - 451 - ], - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 2 - } - } - }, - { - "type": "MustacheKeyword", - "value": "#each", - "range": [ - 451, - 456 - ], - "loc": { - "start": { - "line": 25, - "column": 2 - }, - "end": { - "line": 25, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "as", - "range": [ - 466, - 468 - ], - "loc": { - "start": { - "line": 25, - "column": 17 - }, - "end": { - "line": 25, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "message", - "range": [ - 469, - 476 - ], - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 476, - 477 - ], - "loc": { - "start": { - "line": 25, - "column": 27 - }, - "end": { - "line": 25, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 480, - 481 - ], - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 3 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 481, - 482 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 482, - 483 - ], - "loc": { - "start": { - "line": 26, - "column": 4 - }, - "end": { - "line": 26, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 483, - 484 - ], - "loc": { - "start": { - "line": 26, - "column": 5 - }, - "end": { - "line": 26, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "message", - "range": [ - 484, - 491 - ], - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 491, - 492 - ], - "loc": { - "start": { - "line": 26, - "column": 13 - }, - "end": { - "line": 26, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 492, - 493 - ], - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 493, - 494 - ], - "loc": { - "start": { - "line": 26, - "column": 15 - }, - "end": { - "line": 26, - "column": 16 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 494, - 495 - ], - "loc": { - "start": { - "line": 26, - "column": 16 - }, - "end": { - "line": 26, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 495, - 496 - ], - "loc": { - "start": { - "line": 26, - "column": 17 - }, - "end": { - "line": 26, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 498, - 499 - ], - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 2 - } - } - }, - { - "type": "MustacheKeyword", - "value": "/each", - "range": [ - 499, - 504 - ], - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 504, - 505 - ], - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 505, - 506 - ], - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 28, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 506, - 507 - ], - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 507, - 508 - ], - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "div", - "range": [ - 508, - 511 - ], - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 511, - 512 - ], - "loc": { - "start": { - "line": 28, - "column": 5 - }, - "end": { - "line": 28, - "column": 6 - } - } - } - ], - "range": [ - 0, - 513 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 29, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json deleted file mode 100644 index f1aa55a2..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "messages", - "line": 5, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json deleted file mode 100644 index ab3d910e..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/04-$effect-pre-scope-output.json +++ /dev/null @@ -1,2152 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$$slots", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$props", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$restProps", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 83, - 90 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "tick", - "identifiers": [ - { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - ], - "defs": [ - { - "type": "ImportBinding", - "name": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "node": { - "type": "ImportSpecifier", - "imported": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "local": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 341, - 345 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - } - ] - }, - { - "name": "div", - "identifiers": [ - { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "init": null, - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 110, - 113 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 297, - 300 - ], - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 313, - 316 - ], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 44 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 365, - 368 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 381, - 384 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 443, - 446 - ], - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ] - }, - { - "name": "messages", - "identifiers": [ - { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "init": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 68, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - "range": [ - 57, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 18 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 217, - 225 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 83, - 90 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 443, - 446 - ], - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 110, - 113 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 217, - 225 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 297, - 300 - ], - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 313, - 316 - ], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 44 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ], - "childScopes": [ - { - "type": "block", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 341, - 345 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 365, - 368 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 381, - 384 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 365, - 368 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 381, - 384 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 341, - 345 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 365, - 368 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 381, - 384 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 110, - 113 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "messages", - "range": [ - 217, - 225 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "messages", - "range": [ - 57, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 278, - 281 - ], - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 297, - 300 - ], - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 313, - 316 - ], - "loc": { - "start": { - "line": 16, - "column": 41 - }, - "end": { - "line": 16, - "column": 44 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "tick", - "range": [ - 341, - 345 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 7 - } - } - }, - "from": "block", - "init": null, - "resolved": { - "type": "Identifier", - "name": "tick", - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 365, - 368 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "div", - "range": [ - 381, - 384 - ], - "loc": { - "start": { - "line": 18, - "column": 20 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "div", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "message", - "identifiers": [ - { - "type": "Identifier", - "name": "message", - "range": [ - 469, - 476 - ], - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 27 - } - } - } - ], - "defs": [ - { - "type": "Parameter", - "name": { - "type": "Identifier", - "name": "message", - "range": [ - 469, - 476 - ], - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 27 - } - } - }, - "node": { - "type": "SvelteEachBlock", - "expression": { - "type": "Identifier", - "name": "messages", - "range": [ - 457, - 465 - ], - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - "context": { - "type": "Identifier", - "name": "message", - "range": [ - 469, - 476 - ], - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 27 - } - } - }, - "index": null, - "key": null, - "children": [ - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 481, - 482 - ], - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 4 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 480, - 483 - ], - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 5 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "message", - "range": [ - 484, - 491 - ], - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 13 - } - } - }, - "range": [ - 483, - 492 - ], - "loc": { - "start": { - "line": 26, - "column": 5 - }, - "end": { - "line": 26, - "column": 14 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 492, - 496 - ], - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 18 - } - } - }, - "range": [ - 480, - 496 - ], - "loc": { - "start": { - "line": 26, - "column": 2 - }, - "end": { - "line": 26, - "column": 18 - } - } - } - ], - "else": null, - "range": [ - 450, - 505 - ], - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 27, - "column": 8 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "message", - "range": [ - 484, - 491 - ], - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 13 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "message", - "range": [ - 469, - 476 - ], - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 27 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "message", - "range": [ - 484, - 491 - ], - "loc": { - "start": { - "line": 26, - "column": 6 - }, - "end": { - "line": 26, - "column": 13 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "message", - "range": [ - 469, - 476 - ], - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 27 - } - } - } - } - ], - "childScopes": [], - "through": [] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$effect", - "range": [ - 83, - 90 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte deleted file mode 100644 index 9f8ddff5..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-input.svelte +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json deleted file mode 100644 index 2f801b22..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-no-unused-vars-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "no-unused-vars", - "code": "optionalProp", - "line": 2, - "column": 11 - }, - { - "ruleId": "no-unused-vars", - "code": "requiredProp", - "line": 2, - "column": 30 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json deleted file mode 100644 index 767af0de..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-output.json +++ /dev/null @@ -1,699 +0,0 @@ -{ - "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": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "right": { - "type": "Literal", - "raw": "42", - "value": 42, - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "range": [ - 19, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "range": [ - 19, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - ], - "range": [ - 17, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - "optional": false, - "range": [ - 55, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 54 - } - } - }, - "range": [ - 17, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 54 - } - } - } - ], - "range": [ - 13, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 55 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 65, - 74 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "range": [ - 0, - 74 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Numeric", - "value": "42", - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - { - "type": "Identifier", - "value": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 2, - "column": 52 - }, - "end": { - "line": 2, - "column": 53 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 54 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 54 - }, - "end": { - "line": 2, - "column": 55 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 67, - 73 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - } - ], - "range": [ - 0, - 75 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json deleted file mode 100644 index 0f3914ff..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-prefer-const-result.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "optionalProp", - "line": 2, - "column": 11 - }, - { - "ruleId": "prefer-const", - "code": "requiredProp", - "line": 2, - "column": 30 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json deleted file mode 100644 index 6a56a722..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/05-$props-scope-output.json +++ /dev/null @@ -1,913 +0,0 @@ -{ - "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": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "optionalProp", - "identifiers": [ - { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "right": { - "type": "Literal", - "raw": "42", - "value": 42, - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "range": [ - 19, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "range": [ - 19, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - ], - "range": [ - 17, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - "optional": false, - "range": [ - 55, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 54 - } - } - }, - "range": [ - 17, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 54 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - ] - }, - { - "name": "requiredProp", - "identifiers": [ - { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "right": { - "type": "Literal", - "raw": "42", - "value": 42, - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "range": [ - 19, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "range": [ - 19, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - ], - "range": [ - 17, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - "optional": false, - "range": [ - 55, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 54 - } - } - }, - "range": [ - 17, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 54 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "optionalProp", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "requiredProp", - "range": [ - 38, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte deleted file mode 100644 index c3d4c6a4..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-input.svelte +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json deleted file mode 100644 index a42744a8..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-no-unused-vars-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "no-unused-vars", - "code": "theCatch", - "line": 2, - "column": 18 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json deleted file mode 100644 index 11f6e0a4..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-output.json +++ /dev/null @@ -1,570 +0,0 @@ -{ - "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": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "catch", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - "range": [ - 19, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 25 - } - } - } - ], - "range": [ - 17, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "optional": false, - "range": [ - 39, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - "range": [ - 17, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 38 - } - } - } - ], - "range": [ - 13, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 39 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 49, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "range": [ - 0, - 58 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "catch", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "$props", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - } - ], - "range": [ - 0, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json deleted file mode 100644 index 7874e547..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "theCatch", - "line": 2, - "column": 18 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json deleted file mode 100644 index ba9b7a52..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-requirements.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "test": { - "eslint": ">=8.0.0" - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json deleted file mode 100644 index 2b5aa6ea..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/06-$props-scope-output.json +++ /dev/null @@ -1,389 +0,0 @@ -{ - "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": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "theCatch", - "identifiers": [ - { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "catch", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - "range": [ - 19, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 25 - } - } - } - ], - "range": [ - 17, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "optional": false, - "range": [ - 39, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - "range": [ - 17, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 38 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "theCatch", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 25 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte deleted file mode 100644 index 1c4db2a1..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-input.svelte +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json deleted file mode 100644 index ae6a736e..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-no-unused-vars-result.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "ruleId": "no-unused-vars", - "code": "a", - "line": 2, - "column": 11 - }, - { - "ruleId": "no-unused-vars", - "code": "b", - "line": 2, - "column": 14 - }, - { - "ruleId": "no-unused-vars", - "code": "c", - "line": 2, - "column": 17 - }, - { - "ruleId": "no-unused-vars", - "code": "everythingElse", - "line": 2, - "column": 23 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json deleted file mode 100644 index 080cd01a..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-output.json +++ /dev/null @@ -1,809 +0,0 @@ -{ - "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": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "range": [ - 28, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - ], - "range": [ - 17, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "optional": false, - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 49 - } - } - }, - "range": [ - 17, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 49 - } - } - } - ], - "range": [ - 13, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 50 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 60, - 69 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "range": [ - 0, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 28, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - } - } - }, - { - "type": "Identifier", - "value": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 47 - }, - "end": { - "line": 2, - "column": 48 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 2, - "column": 49 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 49 - }, - "end": { - "line": 2, - "column": 50 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - } - ], - "range": [ - 0, - 70 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json deleted file mode 100644 index ed9c5e82..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-prefer-const-result.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "a", - "line": 2, - "column": 11 - }, - { - "ruleId": "prefer-const", - "code": "b", - "line": 2, - "column": 14 - }, - { - "ruleId": "prefer-const", - "code": "c", - "line": 2, - "column": 17 - }, - { - "ruleId": "prefer-const", - "code": "everythingElse", - "line": 2, - "column": 23 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json deleted file mode 100644 index 308e284e..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/07-$props-scope-output.json +++ /dev/null @@ -1,1759 +0,0 @@ -{ - "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": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "a", - "identifiers": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "range": [ - 28, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - ], - "range": [ - 17, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "optional": false, - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 49 - } - } - }, - "range": [ - 17, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 49 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - } - } - ] - }, - { - "name": "b", - "identifiers": [ - { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "range": [ - 28, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - ], - "range": [ - 17, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "optional": false, - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 49 - } - } - }, - "range": [ - 17, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 49 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - } - ] - }, - { - "name": "c", - "identifiers": [ - { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "range": [ - 28, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - ], - "range": [ - 17, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "optional": false, - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 49 - } - } - }, - "range": [ - 17, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 49 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - } - ] - }, - { - "name": "everythingElse", - "identifiers": [ - { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "range": [ - 28, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - ], - "range": [ - 17, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "optional": false, - "range": [ - 50, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 49 - } - } - }, - "range": [ - 17, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 49 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 31, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 36 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte deleted file mode 100644 index 9fa47908..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-input.svelte +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json deleted file mode 100644 index 70377cef..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-no-unused-vars-result.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "ruleId": "no-unused-vars", - "code": "a", - "line": 3, - "column": 11 - }, - { - "ruleId": "no-unused-vars", - "code": "b", - "line": 3, - "column": 14 - }, - { - "ruleId": "no-unused-vars", - "code": "c", - "line": 3, - "column": 17 - }, - { - "ruleId": "no-unused-vars", - "code": "everythingElse", - "line": 3, - "column": 23 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json deleted file mode 100644 index 9ce52f34..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-output.json +++ /dev/null @@ -1,1208 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteScriptElement", - "name": { - "type": "SvelteName", - "name": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteAttribute", - "key": { - "type": "SvelteName", - "name": "lang", - "range": [ - 8, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "boolean": false, - "value": [ - { - "type": "SvelteLiteral", - "value": "ts", - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 8, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "selfClosing": false, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "body": [ - { - "type": "TSTypeAliasDeclaration", - "id": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "typeAnnotation": { - "type": "TSTypeLiteral", - "members": [], - "range": [ - 38, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - "range": [ - 23, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "optional": false, - "range": [ - 60, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - ], - "range": [ - 49, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "optional": false, - "typeArguments": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "TSTypeReference", - "typeName": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - } - ], - "range": [ - 88, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 47 - }, - "end": { - "line": 3, - "column": 56 - } - } - }, - "range": [ - 82, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 58 - } - } - }, - "range": [ - 49, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 58 - } - } - } - ], - "range": [ - 45, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 59 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 101, - 110 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - "range": [ - 0, - 110 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "lang", - "range": [ - 8, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "\"", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "HTMLText", - "value": "ts", - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "\"", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "type", - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "MyProps", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 45, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 60, - 63 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 37 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 3, - "column": 39 - }, - "end": { - "line": 3, - "column": 40 - } - } - }, - { - "type": "Identifier", - "value": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 88, - 89 - ], - "loc": { - "start": { - "line": 3, - "column": 47 - }, - "end": { - "line": 3, - "column": 48 - } - } - }, - { - "type": "Identifier", - "value": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 55 - }, - "end": { - "line": 3, - "column": 56 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 97, - 98 - ], - "loc": { - "start": { - "line": 3, - "column": 56 - }, - "end": { - "line": 3, - "column": 57 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 57 - }, - "end": { - "line": 3, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 99, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 58 - }, - "end": { - "line": 3, - "column": 59 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 101, - 102 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 103, - 109 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - } - ], - "range": [ - 0, - 111 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json deleted file mode 100644 index 368783a9..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-prefer-const-result.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "a", - "line": 3, - "column": 11 - }, - { - "ruleId": "prefer-const", - "code": "b", - "line": 3, - "column": 14 - }, - { - "ruleId": "prefer-const", - "code": "c", - "line": 3, - "column": 17 - }, - { - "ruleId": "prefer-const", - "code": "everythingElse", - "line": 3, - "column": 23 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json deleted file mode 100644 index e03dc5ca..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-requirements.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "test": { - "@typescript-eslint/parser": ">=6.0.0" - }, - "scope": { - "@typescript-eslint/parser": ">=6.5.0" - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json deleted file mode 100644 index e81f27c0..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/08-$props-ts-scope-output.json +++ /dev/null @@ -1,2160 +0,0 @@ -{ - "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": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "MyProps", - "identifiers": [ - { - "type": "Identifier", - "name": "MyProps", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "defs": [ - { - "type": "Type", - "name": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "node": { - "type": "TSTypeAliasDeclaration", - "id": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "typeAnnotation": { - "type": "TSTypeLiteral", - "members": [], - "range": [ - 38, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - "range": [ - 23, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - } - ] - }, - { - "name": "a", - "identifiers": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "optional": false, - "range": [ - 60, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - ], - "range": [ - 49, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "optional": false, - "typeArguments": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "TSTypeReference", - "typeName": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - } - ], - "range": [ - 88, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 47 - }, - "end": { - "line": 3, - "column": 56 - } - } - }, - "range": [ - 82, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 58 - } - } - }, - "range": [ - 49, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 58 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ] - }, - { - "name": "b", - "identifiers": [ - { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "optional": false, - "range": [ - 60, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - ], - "range": [ - 49, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "optional": false, - "typeArguments": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "TSTypeReference", - "typeName": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - } - ], - "range": [ - 88, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 47 - }, - "end": { - "line": 3, - "column": 56 - } - } - }, - "range": [ - 82, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 58 - } - } - }, - "range": [ - 49, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 58 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - } - } - ] - }, - { - "name": "c", - "identifiers": [ - { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "optional": false, - "range": [ - 60, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - ], - "range": [ - 49, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "optional": false, - "typeArguments": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "TSTypeReference", - "typeName": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - } - ], - "range": [ - 88, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 47 - }, - "end": { - "line": 3, - "column": 56 - } - } - }, - "range": [ - 82, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 58 - } - } - }, - "range": [ - 49, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 58 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - } - } - ] - }, - { - "name": "everythingElse", - "identifiers": [ - { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "optional": false, - "range": [ - 60, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - ], - "range": [ - 49, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "optional": false, - "typeArguments": { - "type": "TSTypeParameterInstantiation", - "params": [ - { - "type": "TSTypeReference", - "typeName": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - } - ], - "range": [ - 88, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 47 - }, - "end": { - "line": 3, - "column": 56 - } - } - }, - "range": [ - 82, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 58 - } - } - }, - "range": [ - 49, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 58 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "a", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "b", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "c", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "everythingElse", - "range": [ - 63, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 36 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 89, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 48 - }, - "end": { - "line": 3, - "column": 55 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "MyProps", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$props", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte deleted file mode 100644 index 49126eaa..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-input.svelte +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json deleted file mode 100644 index 739d2d05..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-output.json +++ /dev/null @@ -1,390 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteHTMLComment", - "value": " this can be `true` or `false` ", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "special", - "name": { - "type": "SvelteName", - "name": "svelte:options", - "range": [ - 40, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteAttribute", - "key": { - "type": "SvelteName", - "name": "runes", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - "boolean": false, - "value": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Literal", - "raw": "true", - "value": true, - "range": [ - 62, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 28 - } - } - } - ], - "range": [ - 55, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 28 - } - } - } - ], - "selfClosing": true, - "range": [ - 39, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - "children": [], - "endTag": null, - "range": [ - 39, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 31 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "HTMLComment", - "value": "", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "svelte:options", - "range": [ - 40, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "runes", - "range": [ - 55, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Boolean", - "value": "true", - "range": [ - 62, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - } - } - ], - "range": [ - 0, - 71 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json deleted file mode 100644 index fbcac79c..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/runes/09-how-to-opt-in-scope-output.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "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": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [], - "references": [], - "childScopes": [], - "through": [] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte deleted file mode 100644 index 66619ed4..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-input.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json deleted file mode 100644 index 49e3817b..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-output.json +++ /dev/null @@ -1,1421 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteScriptElement", - "name": { - "type": "SvelteName", - "name": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 10, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 60, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 60, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 60, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 56, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 44, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 35, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 75, - 84 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - "range": [ - 0, - 84 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 84, - 86 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 9, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 97, - 102 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 94, - 102 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - "expression": { - "type": "Identifier", - "name": "increment", - "range": [ - 104, - 113 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 27 - } - } - }, - "range": [ - 94, - 114 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 28 - } - } - } - ], - "selfClosing": false, - "range": [ - 86, - 115 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\tclicks: ", - "range": [ - 115, - 125 - ], - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "count", - "range": [ - 126, - 131 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 125, - 132 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 132, - 133 - ], - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 11, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 133, - 142 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 9 - } - } - }, - "range": [ - 86, - 142 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 11, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 35, - 43 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 44, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 60, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "+=", - "range": [ - 66, - 68 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 75, - 76 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 76, - 77 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 77, - 83 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 84, - 86 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 9, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 86, - 87 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 94, - 96 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 97, - 102 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 103, - 104 - ], - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 104, - 113 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 113, - 114 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 114, - 115 - ], - "loc": { - "start": { - "line": 9, - "column": 28 - }, - "end": { - "line": 9, - "column": 29 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 115, - 117 - ], - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 10, - "column": 1 - } - } - }, - { - "type": "HTMLText", - "value": "clicks:", - "range": [ - 117, - 124 - ], - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 124, - 125 - ], - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 125, - 126 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 126, - 131 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 131, - 132 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 132, - 133 - ], - "loc": { - "start": { - "line": 10, - "column": 16 - }, - "end": { - "line": 11, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 133, - 134 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 134, - 135 - ], - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 11, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 135, - 141 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 141, - 142 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 9 - } - } - } - ], - "range": [ - 0, - 143 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json deleted file mode 100644 index c28d4d8b..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/01-scope-output.json +++ /dev/null @@ -1,826 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$$slots", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$props", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$$restProps", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 60, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 126, - 131 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "name": "increment", - "identifiers": [ - { - "type": "Identifier", - "name": "increment", - "range": [ - 44, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "increment", - "range": [ - 44, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 60, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 60, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 60, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 56, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 44, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 35, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 104, - 113 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 27 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 44, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 104, - 113 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 27 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 44, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 126, - 131 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 60, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 60, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte deleted file mode 100644 index 05fb97ef..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-input.svelte +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json deleted file mode 100644 index eaf4bc74..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-output.json +++ /dev/null @@ -1,2411 +0,0 @@ -{ - "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": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "optional": false, - "range": [ - 51, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - "range": [ - 43, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 23 - } - } - } - ], - "range": [ - 39, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 91, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 100, - 101 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "range": [ - 91, - 101 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "range": [ - 91, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 14 - } - } - } - ], - "range": [ - 86, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 7, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - "params": [], - "range": [ - 65, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 126, - 131 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 12 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 143, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "range": [ - 136, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 29 - } - } - } - ], - "range": [ - 134, - 150 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 131, - 150 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - "range": [ - 122, - 150 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "increment", - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "increment", - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - } - ], - "range": [ - 117, - 168 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - "range": [ - 110, - 169 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 12, - "column": 4 - } - } - } - ], - "range": [ - 35, - 172 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 19, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "params": [], - "range": [ - 10, - 172 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "const", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 191, - 204 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - "optional": false, - "range": [ - 191, - 206 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 32 - } - } - }, - "range": [ - 181, - 206 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 32 - } - } - } - ], - "range": [ - 175, - 207 - ], - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 33 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 208, - 217 - ], - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - "range": [ - 0, - 217 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 217, - 219 - ], - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 18, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 220, - 226 - ], - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 230, - 235 - ], - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 227, - 235 - ], - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 16 - } - } - }, - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "counter", - "range": [ - 237, - 244 - ], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "increment", - "range": [ - 245, - 254 - ], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 35 - } - } - }, - "range": [ - 237, - 254 - ], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 35 - } - } - }, - "range": [ - 227, - 255 - ], - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 36 - } - } - } - ], - "selfClosing": false, - "range": [ - 219, - 256 - ], - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\tclicks: ", - "range": [ - 256, - 266 - ], - "loc": { - "start": { - "line": 18, - "column": 37 - }, - "end": { - "line": 19, - "column": 9 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "counter", - "range": [ - 267, - 274 - ], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - "optional": false, - "property": { - "type": "Identifier", - "name": "count", - "range": [ - 275, - 280 - ], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 23 - } - } - }, - "range": [ - 267, - 280 - ], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 23 - } - } - }, - "range": [ - 266, - 281 - ], - "loc": { - "start": { - "line": 19, - "column": 9 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 19, - "column": 24 - }, - "end": { - "line": 20, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 282, - 291 - ], - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 9 - } - } - }, - "range": [ - 219, - 291 - ], - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 20, - "column": 9 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 10, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "createCounter", - "range": [ - 19, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "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": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 39, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 65, - 73 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 84, - 85 - ], - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 86, - 87 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 91, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "+=", - "range": [ - 97, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 100, - 101 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 101, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 110, - 116 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 117, - 118 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 122, - 125 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 126, - 131 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 131, - 132 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 132, - 133 - ], - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 134, - 135 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 136, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 143, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 149, - 150 - ], - "loc": { - "start": { - "line": 10, - "column": 30 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 150, - 151 - ], - "loc": { - "start": { - "line": 10, - "column": 31 - }, - "end": { - "line": 10, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 168, - 169 - ], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 171, - 172 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 175, - 180 - ], - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 189, - 190 - ], - "loc": { - "start": { - "line": 15, - "column": 15 - }, - "end": { - "line": 15, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "createCounter", - "range": [ - 191, - 204 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 15, - "column": 30 - }, - "end": { - "line": 15, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 205, - 206 - ], - "loc": { - "start": { - "line": 15, - "column": 31 - }, - "end": { - "line": 15, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 206, - 207 - ], - "loc": { - "start": { - "line": 15, - "column": 32 - }, - "end": { - "line": 15, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 208, - 209 - ], - "loc": { - "start": { - "line": 16, - "column": 0 - }, - "end": { - "line": 16, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 209, - 210 - ], - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 210, - 216 - ], - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 16, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 216, - 217 - ], - "loc": { - "start": { - "line": 16, - "column": 8 - }, - "end": { - "line": 16, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 217, - 219 - ], - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 18, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 219, - 220 - ], - "loc": { - "start": { - "line": 18, - "column": 0 - }, - "end": { - "line": 18, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 220, - 226 - ], - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 227, - 229 - ], - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 229, - 230 - ], - "loc": { - "start": { - "line": 18, - "column": 10 - }, - "end": { - "line": 18, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 230, - 235 - ], - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 235, - 236 - ], - "loc": { - "start": { - "line": 18, - "column": 16 - }, - "end": { - "line": 18, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 236, - 237 - ], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "counter", - "range": [ - 237, - 244 - ], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 244, - 245 - ], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 245, - 254 - ], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 254, - 255 - ], - "loc": { - "start": { - "line": 18, - "column": 35 - }, - "end": { - "line": 18, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 255, - 256 - ], - "loc": { - "start": { - "line": 18, - "column": 36 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 256, - 258 - ], - "loc": { - "start": { - "line": 18, - "column": 37 - }, - "end": { - "line": 19, - "column": 1 - } - } - }, - { - "type": "HTMLText", - "value": "clicks:", - "range": [ - 258, - 265 - ], - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 8 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 19, - "column": 8 - }, - "end": { - "line": 19, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 266, - 267 - ], - "loc": { - "start": { - "line": 19, - "column": 9 - }, - "end": { - "line": 19, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "counter", - "range": [ - 267, - 274 - ], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 274, - 275 - ], - "loc": { - "start": { - "line": 19, - "column": 17 - }, - "end": { - "line": 19, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 275, - 280 - ], - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 280, - 281 - ], - "loc": { - "start": { - "line": 19, - "column": 23 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 19, - "column": 24 - }, - "end": { - "line": 20, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 282, - 283 - ], - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 283, - 284 - ], - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 20, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 284, - 290 - ], - "loc": { - "start": { - "line": 20, - "column": 2 - }, - "end": { - "line": 20, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 290, - 291 - ], - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 9 - } - } - } - ], - "range": [ - 0, - 292 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 21, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json deleted file mode 100644 index f177577d..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/02-scope-output.json +++ /dev/null @@ -1,1918 +0,0 @@ -{ - "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": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "createCounter", - "identifiers": [ - { - "type": "Identifier", - "name": "createCounter", - "range": [ - 19, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 19, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "optional": false, - "range": [ - 51, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - "range": [ - 43, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 23 - } - } - } - ], - "range": [ - 39, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 91, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 100, - 101 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "range": [ - 91, - 101 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "range": [ - 91, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 14 - } - } - } - ], - "range": [ - 86, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 7, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - "params": [], - "range": [ - 65, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 126, - 131 - ], - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 12 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 143, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "range": [ - 136, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 29 - } - } - } - ], - "range": [ - 134, - 150 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 131, - 150 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - "range": [ - 122, - 150 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 31 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "increment", - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "increment", - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - } - ], - "range": [ - 117, - 168 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - "range": [ - 110, - 169 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 12, - "column": 4 - } - } - } - ], - "range": [ - 35, - 172 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 19, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "params": [], - "range": [ - 10, - 172 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 191, - 204 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 19, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - } - ] - }, - { - "name": "counter", - "identifiers": [ - { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [], - "callee": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 191, - 204 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - "optional": false, - "range": [ - 191, - 206 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 32 - } - } - }, - "range": [ - 181, - 206 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 32 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "counter", - "range": [ - 237, - 244 - ], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "counter", - "range": [ - 267, - 274 - ], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 191, - 204 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 19, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 23 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "counter", - "range": [ - 237, - 244 - ], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "counter", - "range": [ - 267, - 274 - ], - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "counter", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "optional": false, - "range": [ - 51, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - "range": [ - 43, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 23 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 91, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 143, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ] - }, - { - "name": "increment", - "identifiers": [ - { - "type": "Identifier", - "name": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 91, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 100, - 101 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "range": [ - 91, - 101 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "range": [ - 91, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 14 - } - } - } - ], - "range": [ - 86, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 7, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - "params": [], - "range": [ - 65, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 155, - 164 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 74, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 20 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 91, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 91, - 96 - ], - "loc": { - "start": { - "line": 6, - "column": 3 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 143, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 143, - 148 - ], - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 43, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 51, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js deleted file mode 100644 index 73af2497..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-input.svelte.js +++ /dev/null @@ -1,14 +0,0 @@ -export function createCounter() { - let count = $state(0); - - function increment() { - count += 1; - } - - return { - get count() { - return count; - }, - increment - }; -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json deleted file mode 100644 index 120d785e..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-output.json +++ /dev/null @@ -1,1270 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 39, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 35, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 81, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 60, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 117, - 122 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 130, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 16 - } - } - } - ], - "range": [ - 125, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 122, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "range": [ - 113, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - } - ], - "range": [ - 109, - 163 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "range": [ - 102, - 164 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 13, - "column": 3 - } - } - } - ], - "range": [ - 32, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "params": [], - "range": [ - 7, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "source": null, - "specifiers": [], - "range": [ - 0, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "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": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 35, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "+=", - "range": [ - 91, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 102, - 108 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 113, - 116 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 117, - 122 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 122, - 123 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 125, - 126 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 130, - 136 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 142, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 146, - 147 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 147, - 148 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 162, - 163 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 163, - 164 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 165, - 166 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - } - ], - "range": [ - 0, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json deleted file mode 100644 index ff248e38..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-scope-output.json +++ /dev/null @@ -1,1458 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "createCounter", - "identifiers": [ - { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 39, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 35, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 81, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 60, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 117, - 122 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 130, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 16 - } - } - } - ], - "range": [ - 125, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 122, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "range": [ - 113, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - } - ], - "range": [ - 109, - 163 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "range": [ - 102, - 164 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 13, - "column": 3 - } - } - } - ], - "range": [ - 32, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "params": [], - "range": [ - 7, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 14, - "column": 1 - } - } - } - } - ], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 39, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "name": "increment", - "identifiers": [ - { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 81, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 60, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts deleted file mode 100644 index 73af2497..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-input.svelte.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function createCounter() { - let count = $state(0); - - function increment() { - count += 1; - } - - return { - get count() { - return count; - }, - increment - }; -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json deleted file mode 100644 index 2bec2091..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-output.json +++ /dev/null @@ -1,1271 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 39, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 35, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 81, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 60, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 117, - 122 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 130, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 16 - } - } - } - ], - "range": [ - 125, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 122, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "range": [ - 113, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - } - ], - "range": [ - 109, - 163 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "range": [ - 102, - 164 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 13, - "column": 3 - } - } - } - ], - "range": [ - 32, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "params": [], - "range": [ - 7, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "exportKind": "value", - "source": null, - "specifiers": [], - "range": [ - 0, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - } - ], - "sourceType": "module", - "comments": [], - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "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": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 35, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 60, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "+=", - "range": [ - 91, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 102, - 108 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 113, - 116 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 117, - 122 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 122, - 123 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 125, - 126 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 130, - 136 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 142, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 146, - 147 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 147, - 148 - ], - "loc": { - "start": { - "line": 11, - "column": 3 - }, - "end": { - "line": 11, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 162, - 163 - ], - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 163, - 164 - ], - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 165, - 166 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - } - ], - "range": [ - 0, - 167 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 15, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json deleted file mode 100644 index ff248e38..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-scope-output.json +++ /dev/null @@ -1,1458 +0,0 @@ -{ - "type": "global", - "variables": [ - { - "name": "$state", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "createCounter", - "identifiers": [ - { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 39, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - ], - "range": [ - 35, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 81, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 60, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "kind": "get", - "computed": false, - "key": { - "type": "Identifier", - "name": "count", - "range": [ - 117, - 122 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - "method": false, - "shorthand": false, - "value": { - "type": "FunctionExpression", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "range": [ - 130, - 143 - ], - "loc": { - "start": { - "line": 10, - "column": 3 - }, - "end": { - "line": 10, - "column": 16 - } - } - } - ], - "range": [ - 125, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "expression": false, - "generator": false, - "id": null, - "params": [], - "range": [ - 122, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "range": [ - 113, - 147 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Property", - "kind": "init", - "computed": false, - "key": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "method": false, - "shorthand": true, - "value": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - } - ], - "range": [ - 109, - 163 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 13, - "column": 2 - } - } - }, - "range": [ - 102, - 164 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 13, - "column": 3 - } - } - } - ], - "range": [ - 32, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "createCounter", - "range": [ - 16, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "params": [], - "range": [ - 7, - 166 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 14, - "column": 1 - } - } - } - } - ], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "range": [ - 39, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "name": "increment", - "identifiers": [ - { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - ], - "defs": [ - { - "type": "FunctionName", - "name": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "node": { - "type": "FunctionDeclaration", - "async": false, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "operator": "+=", - "right": { - "type": "Literal", - "raw": "1", - "value": 1, - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 95 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "range": [ - 85, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 13 - } - } - } - ], - "range": [ - 81, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "params": [], - "range": [ - 60, - 99 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "from": "function", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "increment", - "range": [ - 151, - 160 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "increment", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 19 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - }, - { - "type": "function", - "variables": [ - { - "name": "arguments", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 137, - 142 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - "from": "function", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 39, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - "from": "function", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts b/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts deleted file mode 100644 index 08bfcd3b..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/docs/universal-reactivity/03-ts-type-output.svelte.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function createCounter() { // createCounter: () => { readonly count: number; increment: () => void; } - let count = $state(0); // count: number, $state(0): 0 - - function increment() { // increment: () => void - count += 1; // count: number - } - - return { - get count() { // count: number - return count; // count: number - }, - increment // increment: () => void, increment: () => void - }; -} diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte deleted file mode 100644 index 246836b4..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-input.svelte +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -

{count} doubled is {double}

diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json deleted file mode 100644 index 2f0bd0fe..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-output.json +++ /dev/null @@ -1,2371 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "SvelteElement", - "kind": "special", - "name": { - "type": "SvelteName", - "name": "svelte:options", - "range": [ - 1, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteAttribute", - "key": { - "type": "SvelteName", - "name": "runes", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "boolean": false, - "value": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Literal", - "raw": "true", - "value": true, - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "range": [ - 16, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "selfClosing": true, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "children": [], - "endTag": null, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 3, - "column": 0 - } - } - }, - { - "type": "SvelteScriptElement", - "name": { - "type": "SvelteName", - "name": "script", - "range": [ - 34, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 33, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - "body": [ - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 55, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "range": [ - 47, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 22 - } - } - } - ], - "range": [ - 43, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 89, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 97, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 32 - } - } - }, - "range": [ - 89, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 80, - 99 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - "range": [ - 71, - 99 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 33 - } - } - } - ], - "range": [ - 67, - 100 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 34 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 101, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - "range": [ - 33, - 110 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 110, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 8, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "button", - "range": [ - 113, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 7 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [ - { - "type": "SvelteDirective", - "kind": "EventHandler", - "key": { - "type": "SvelteDirectiveKey", - "name": { - "type": "SvelteName", - "name": "click", - "range": [ - 123, - 128 - ], - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 16 - } - } - }, - "modifiers": [], - "range": [ - 120, - 128 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 16 - } - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "async": false, - "body": { - "type": "UpdateExpression", - "argument": { - "type": "Identifier", - "name": "count", - "range": [ - 136, - 141 - ], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - "operator": "++", - "prefix": false, - "range": [ - 136, - 143 - ], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 31 - } - } - }, - "expression": true, - "generator": false, - "id": null, - "params": [], - "range": [ - 130, - 143 - ], - "loc": { - "start": { - "line": 8, - "column": 18 - }, - "end": { - "line": 8, - "column": 31 - } - } - }, - "range": [ - 120, - 144 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 32 - } - } - } - ], - "selfClosing": false, - "range": [ - 112, - 145 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 33 - } - } - }, - "children": [ - { - "type": "SvelteText", - "value": "\n\t", - "range": [ - 145, - 147 - ], - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "double", - "range": [ - 148, - 154 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "range": [ - 147, - 155 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n", - "range": [ - 155, - 156 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 10, - "column": 0 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 156, - 165 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - "range": [ - 112, - 165 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "SvelteText", - "value": "\n\n", - "range": [ - 165, - 167 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 12, - "column": 0 - } - } - }, - { - "type": "SvelteElement", - "kind": "html", - "name": { - "type": "SvelteName", - "name": "p", - "range": [ - 168, - 169 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - "startTag": { - "type": "SvelteStartTag", - "attributes": [], - "selfClosing": false, - "range": [ - 167, - 170 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - "children": [ - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "count", - "range": [ - 171, - 176 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 9 - } - } - }, - "range": [ - 170, - 177 - ], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - { - "type": "SvelteText", - "value": " doubled is ", - "range": [ - 177, - 189 - ], - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 22 - } - } - }, - { - "type": "SvelteMustacheTag", - "kind": "text", - "expression": { - "type": "Identifier", - "name": "double", - "range": [ - 190, - 196 - ], - "loc": { - "start": { - "line": 12, - "column": 23 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "range": [ - 189, - 197 - ], - "loc": { - "start": { - "line": 12, - "column": 22 - }, - "end": { - "line": 12, - "column": 30 - } - } - } - ], - "endTag": { - "type": "SvelteEndTag", - "range": [ - 197, - 201 - ], - "loc": { - "start": { - "line": 12, - "column": 30 - }, - "end": { - "line": 12, - "column": 34 - } - } - }, - "range": [ - 167, - 201 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 34 - } - } - } - ], - "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:options", - "range": [ - 1, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "runes", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Boolean", - "value": "true", - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "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": "HTMLText", - "value": "\n\n", - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 3, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 34, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 67, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "$derived", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 88, - 89 - ], - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 89, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 5, - "column": 30 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 97, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 5, - "column": 32 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 99, - 100 - ], - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 5, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 101, - 102 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "script", - "range": [ - 103, - 109 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 110, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 8, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 112, - 113 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 113, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 7 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "on", - "range": [ - 120, - 122 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 122, - 123 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 11 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "click", - "range": [ - 123, - 128 - ], - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 128, - 129 - ], - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 129, - 130 - ], - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 130, - 131 - ], - "loc": { - "start": { - "line": 8, - "column": 18 - }, - "end": { - "line": 8, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 131, - 132 - ], - "loc": { - "start": { - "line": 8, - "column": 19 - }, - "end": { - "line": 8, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 133, - 135 - ], - "loc": { - "start": { - "line": 8, - "column": 21 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 136, - 141 - ], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "++", - "range": [ - 141, - 143 - ], - "loc": { - "start": { - "line": 8, - "column": 29 - }, - "end": { - "line": 8, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 143, - 144 - ], - "loc": { - "start": { - "line": 8, - "column": 31 - }, - "end": { - "line": 8, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 144, - 145 - ], - "loc": { - "start": { - "line": 8, - "column": 32 - }, - "end": { - "line": 8, - "column": 33 - } - } - }, - { - "type": "HTMLText", - "value": "\n\t", - "range": [ - 145, - 147 - ], - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 147, - 148 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 148, - 154 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 154, - 155 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n", - "range": [ - 155, - 156 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 10, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 156, - 157 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 157, - 158 - ], - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 10, - "column": 2 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "button", - "range": [ - 158, - 164 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 164, - 165 - ], - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "HTMLText", - "value": "\n\n", - "range": [ - 165, - 167 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 12, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 168, - 169 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 169, - 170 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 12, - "column": 3 - }, - "end": { - "line": 12, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 171, - 176 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 176, - 177 - ], - "loc": { - "start": { - "line": 12, - "column": 9 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 177, - 178 - ], - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - { - "type": "HTMLText", - "value": "doubled", - "range": [ - 178, - 185 - ], - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 18 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 185, - 186 - ], - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - { - "type": "HTMLText", - "value": "is", - "range": [ - 186, - 188 - ], - "loc": { - "start": { - "line": 12, - "column": 19 - }, - "end": { - "line": 12, - "column": 21 - } - } - }, - { - "type": "HTMLText", - "value": " ", - "range": [ - 188, - 189 - ], - "loc": { - "start": { - "line": 12, - "column": 21 - }, - "end": { - "line": 12, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 189, - 190 - ], - "loc": { - "start": { - "line": 12, - "column": 22 - }, - "end": { - "line": 12, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "double", - "range": [ - 190, - 196 - ], - "loc": { - "start": { - "line": 12, - "column": 23 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 196, - 197 - ], - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 197, - 198 - ], - "loc": { - "start": { - "line": 12, - "column": 30 - }, - "end": { - "line": 12, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 198, - 199 - ], - "loc": { - "start": { - "line": 12, - "column": 31 - }, - "end": { - "line": 12, - "column": 32 - } - } - }, - { - "type": "HTMLIdentifier", - "value": "p", - "range": [ - 199, - 200 - ], - "loc": { - "start": { - "line": 12, - "column": 32 - }, - "end": { - "line": 12, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 200, - 201 - ], - "loc": { - "start": { - "line": 12, - "column": 33 - }, - "end": { - "line": 12, - "column": 34 - } - } - } - ], - "range": [ - 0, - 202 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 13, - "column": 0 - } - } -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json deleted file mode 100644 index e58a7e7c..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-prefer-const-result.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "ruleId": "prefer-const", - "code": "double", - "line": 5, - "column": 6 - } -] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json b/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json deleted file mode 100644 index efac15fe..00000000 --- a/tests/fixtures/parser/ast/svelte-5-preview/optin-runes01-scope-output.json +++ /dev/null @@ -1,1127 +0,0 @@ -{ - "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": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$derived", - "identifiers": [], - "defs": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - }, - { - "name": "$effect", - "identifiers": [], - "defs": [], - "references": [] - }, - { - "name": "$props", - "identifiers": [], - "defs": [], - "references": [] - } - ], - "references": [], - "childScopes": [ - { - "type": "module", - "variables": [ - { - "name": "count", - "identifiers": [ - { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "Literal", - "raw": "0", - "value": 0, - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "optional": false, - "range": [ - 55, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - "range": [ - 47, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 22 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 89, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 136, - 141 - ], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 171, - 176 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 9 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - } - ] - }, - { - "name": "double", - "identifiers": [ - { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - } - ], - "defs": [ - { - "type": "Variable", - "name": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - "node": { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - "init": { - "type": "CallExpression", - "arguments": [ - { - "type": "BinaryExpression", - "left": { - "type": "Identifier", - "name": "count", - "range": [ - 89, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "operator": "*", - "right": { - "type": "Literal", - "raw": "2", - "value": 2, - "range": [ - 97, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 32 - } - } - }, - "range": [ - 89, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 32 - } - } - } - ], - "callee": { - "type": "Identifier", - "name": "$derived", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "optional": false, - "range": [ - 80, - 99 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - "range": [ - 71, - 99 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 33 - } - } - } - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 148, - 154 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 190, - 196 - ], - "loc": { - "start": { - "line": 12, - "column": 23 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - } - } - ] - } - ], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - "from": "module", - "init": true, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 89, - 94 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 148, - 154 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 171, - 176 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 9 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "double", - "range": [ - 190, - 196 - ], - "loc": { - "start": { - "line": 12, - "column": 23 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - "from": "module", - "init": null, - "resolved": { - "type": "Identifier", - "name": "double", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 11 - } - } - } - } - ], - "childScopes": [ - { - "type": "function", - "variables": [], - "references": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 136, - 141 - ], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - } - ], - "childScopes": [], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "count", - "range": [ - 136, - 141 - ], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 29 - } - } - }, - "from": "function", - "init": false, - "resolved": { - "type": "Identifier", - "name": "count", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 10 - } - } - } - } - ] - } - ], - "through": [ - { - "identifier": { - "type": "Identifier", - "name": "$state", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - "from": "module", - "init": null, - "resolved": null - }, - { - "identifier": { - "type": "Identifier", - "name": "$derived", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - "from": "module", - "init": null, - "resolved": null - } - ] - } - ], - "through": [] -} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json index 25b0f142..ff248e38 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json @@ -10,7 +10,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -35,13 +38,13 @@ "references": [] }, { - "name": "$props", + "name": "$effect", "identifiers": [], "defs": [], "references": [] }, { - "name": "$effect", + "name": "$props", "identifiers": [], "defs": [], "references": [] @@ -58,7 +61,10 @@ { "type": "Identifier", "name": "createCounter", - "range": [16, 29], + "range": [ + 16, + 29 + ], "loc": { "start": { "line": 1, @@ -77,7 +83,10 @@ "name": { "type": "Identifier", "name": "createCounter", - "range": [16, 29], + "range": [ + 16, + 29 + ], "loc": { "start": { "line": 1, @@ -104,7 +113,10 @@ "id": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -123,7 +135,10 @@ "type": "Literal", "raw": "0", "value": 0, - "range": [54, 55], + "range": [ + 54, + 55 + ], "loc": { "start": { "line": 2, @@ -139,7 +154,10 @@ "callee": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -152,7 +170,10 @@ } }, "optional": false, - "range": [47, 56], + "range": [ + 47, + 56 + ], "loc": { "start": { "line": 2, @@ -164,7 +185,10 @@ } } }, - "range": [39, 56], + "range": [ + 39, + 56 + ], "loc": { "start": { "line": 2, @@ -177,7 +201,10 @@ } } ], - "range": [35, 57], + "range": [ + 35, + 57 + ], "loc": { "start": { "line": 2, @@ -202,7 +229,10 @@ "left": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -219,7 +249,10 @@ "type": "Literal", "raw": "1", "value": 1, - "range": [94, 95], + "range": [ + 94, + 95 + ], "loc": { "start": { "line": 5, @@ -231,7 +264,10 @@ } } }, - "range": [85, 95], + "range": [ + 85, + 95 + ], "loc": { "start": { "line": 5, @@ -243,7 +279,10 @@ } } }, - "range": [85, 96], + "range": [ + 85, + 96 + ], "loc": { "start": { "line": 5, @@ -256,7 +295,10 @@ } } ], - "range": [81, 99], + "range": [ + 81, + 99 + ], "loc": { "start": { "line": 4, @@ -273,7 +315,10 @@ "id": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -286,7 +331,10 @@ } }, "params": [], - "range": [60, 99], + "range": [ + 60, + 99 + ], "loc": { "start": { "line": 4, @@ -310,7 +358,10 @@ "key": { "type": "Identifier", "name": "count", - "range": [117, 122], + "range": [ + 117, + 122 + ], "loc": { "start": { "line": 9, @@ -335,7 +386,10 @@ "argument": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -347,7 +401,10 @@ } } }, - "range": [130, 143], + "range": [ + 130, + 143 + ], "loc": { "start": { "line": 10, @@ -360,7 +417,10 @@ } } ], - "range": [125, 147], + "range": [ + 125, + 147 + ], "loc": { "start": { "line": 9, @@ -376,7 +436,10 @@ "generator": false, "id": null, "params": [], - "range": [122, 147], + "range": [ + 122, + 147 + ], "loc": { "start": { "line": 9, @@ -388,7 +451,10 @@ } } }, - "range": [113, 147], + "range": [ + 113, + 147 + ], "loc": { "start": { "line": 9, @@ -407,7 +473,10 @@ "key": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -424,7 +493,10 @@ "value": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -436,7 +508,10 @@ } } }, - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -449,7 +524,10 @@ } } ], - "range": [109, 163], + "range": [ + 109, + 163 + ], "loc": { "start": { "line": 8, @@ -461,7 +539,10 @@ } } }, - "range": [102, 164], + "range": [ + 102, + 164 + ], "loc": { "start": { "line": 8, @@ -474,7 +555,10 @@ } } ], - "range": [32, 166], + "range": [ + 32, + 166 + ], "loc": { "start": { "line": 1, @@ -491,7 +575,10 @@ "id": { "type": "Identifier", "name": "createCounter", - "range": [16, 29], + "range": [ + 16, + 29 + ], "loc": { "start": { "line": 1, @@ -504,7 +591,10 @@ } }, "params": [], - "range": [7, 166], + "range": [ + 7, + 166 + ], "loc": { "start": { "line": 1, @@ -538,7 +628,10 @@ { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -557,7 +650,10 @@ "name": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -574,7 +670,10 @@ "id": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -593,7 +692,10 @@ "type": "Literal", "raw": "0", "value": 0, - "range": [54, 55], + "range": [ + 54, + 55 + ], "loc": { "start": { "line": 2, @@ -609,7 +711,10 @@ "callee": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -622,7 +727,10 @@ } }, "optional": false, - "range": [47, 56], + "range": [ + 47, + 56 + ], "loc": { "start": { "line": 2, @@ -634,7 +742,10 @@ } } }, - "range": [39, 56], + "range": [ + 39, + 56 + ], "loc": { "start": { "line": 2, @@ -653,7 +764,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -670,7 +784,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -687,7 +804,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -704,7 +824,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -721,7 +844,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -738,7 +864,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -759,7 +888,10 @@ { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -778,7 +910,10 @@ "name": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -803,7 +938,10 @@ "left": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -820,7 +958,10 @@ "type": "Literal", "raw": "1", "value": 1, - "range": [94, 95], + "range": [ + 94, + 95 + ], "loc": { "start": { "line": 5, @@ -832,7 +973,10 @@ } } }, - "range": [85, 95], + "range": [ + 85, + 95 + ], "loc": { "start": { "line": 5, @@ -844,7 +988,10 @@ } } }, - "range": [85, 96], + "range": [ + 85, + 96 + ], "loc": { "start": { "line": 5, @@ -857,7 +1004,10 @@ } } ], - "range": [81, 99], + "range": [ + 81, + 99 + ], "loc": { "start": { "line": 4, @@ -874,7 +1024,10 @@ "id": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -887,7 +1040,10 @@ } }, "params": [], - "range": [60, 99], + "range": [ + 60, + 99 + ], "loc": { "start": { "line": 4, @@ -906,7 +1062,10 @@ "identifier": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -923,7 +1082,10 @@ "resolved": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -944,7 +1106,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -961,7 +1126,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -978,7 +1146,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -998,7 +1169,10 @@ "identifier": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -1015,7 +1189,10 @@ "resolved": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -1045,7 +1222,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -1062,7 +1242,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1082,7 +1265,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -1099,7 +1285,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1129,7 +1318,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -1146,7 +1338,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1166,7 +1361,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -1183,7 +1381,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1204,7 +1405,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -1228,7 +1432,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -1248,4 +1455,4 @@ } ], "through": [] -} +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json index 25b0f142..ff248e38 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json @@ -10,7 +10,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -35,13 +38,13 @@ "references": [] }, { - "name": "$props", + "name": "$effect", "identifiers": [], "defs": [], "references": [] }, { - "name": "$effect", + "name": "$props", "identifiers": [], "defs": [], "references": [] @@ -58,7 +61,10 @@ { "type": "Identifier", "name": "createCounter", - "range": [16, 29], + "range": [ + 16, + 29 + ], "loc": { "start": { "line": 1, @@ -77,7 +83,10 @@ "name": { "type": "Identifier", "name": "createCounter", - "range": [16, 29], + "range": [ + 16, + 29 + ], "loc": { "start": { "line": 1, @@ -104,7 +113,10 @@ "id": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -123,7 +135,10 @@ "type": "Literal", "raw": "0", "value": 0, - "range": [54, 55], + "range": [ + 54, + 55 + ], "loc": { "start": { "line": 2, @@ -139,7 +154,10 @@ "callee": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -152,7 +170,10 @@ } }, "optional": false, - "range": [47, 56], + "range": [ + 47, + 56 + ], "loc": { "start": { "line": 2, @@ -164,7 +185,10 @@ } } }, - "range": [39, 56], + "range": [ + 39, + 56 + ], "loc": { "start": { "line": 2, @@ -177,7 +201,10 @@ } } ], - "range": [35, 57], + "range": [ + 35, + 57 + ], "loc": { "start": { "line": 2, @@ -202,7 +229,10 @@ "left": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -219,7 +249,10 @@ "type": "Literal", "raw": "1", "value": 1, - "range": [94, 95], + "range": [ + 94, + 95 + ], "loc": { "start": { "line": 5, @@ -231,7 +264,10 @@ } } }, - "range": [85, 95], + "range": [ + 85, + 95 + ], "loc": { "start": { "line": 5, @@ -243,7 +279,10 @@ } } }, - "range": [85, 96], + "range": [ + 85, + 96 + ], "loc": { "start": { "line": 5, @@ -256,7 +295,10 @@ } } ], - "range": [81, 99], + "range": [ + 81, + 99 + ], "loc": { "start": { "line": 4, @@ -273,7 +315,10 @@ "id": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -286,7 +331,10 @@ } }, "params": [], - "range": [60, 99], + "range": [ + 60, + 99 + ], "loc": { "start": { "line": 4, @@ -310,7 +358,10 @@ "key": { "type": "Identifier", "name": "count", - "range": [117, 122], + "range": [ + 117, + 122 + ], "loc": { "start": { "line": 9, @@ -335,7 +386,10 @@ "argument": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -347,7 +401,10 @@ } } }, - "range": [130, 143], + "range": [ + 130, + 143 + ], "loc": { "start": { "line": 10, @@ -360,7 +417,10 @@ } } ], - "range": [125, 147], + "range": [ + 125, + 147 + ], "loc": { "start": { "line": 9, @@ -376,7 +436,10 @@ "generator": false, "id": null, "params": [], - "range": [122, 147], + "range": [ + 122, + 147 + ], "loc": { "start": { "line": 9, @@ -388,7 +451,10 @@ } } }, - "range": [113, 147], + "range": [ + 113, + 147 + ], "loc": { "start": { "line": 9, @@ -407,7 +473,10 @@ "key": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -424,7 +493,10 @@ "value": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -436,7 +508,10 @@ } } }, - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -449,7 +524,10 @@ } } ], - "range": [109, 163], + "range": [ + 109, + 163 + ], "loc": { "start": { "line": 8, @@ -461,7 +539,10 @@ } } }, - "range": [102, 164], + "range": [ + 102, + 164 + ], "loc": { "start": { "line": 8, @@ -474,7 +555,10 @@ } } ], - "range": [32, 166], + "range": [ + 32, + 166 + ], "loc": { "start": { "line": 1, @@ -491,7 +575,10 @@ "id": { "type": "Identifier", "name": "createCounter", - "range": [16, 29], + "range": [ + 16, + 29 + ], "loc": { "start": { "line": 1, @@ -504,7 +591,10 @@ } }, "params": [], - "range": [7, 166], + "range": [ + 7, + 166 + ], "loc": { "start": { "line": 1, @@ -538,7 +628,10 @@ { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -557,7 +650,10 @@ "name": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -574,7 +670,10 @@ "id": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -593,7 +692,10 @@ "type": "Literal", "raw": "0", "value": 0, - "range": [54, 55], + "range": [ + 54, + 55 + ], "loc": { "start": { "line": 2, @@ -609,7 +711,10 @@ "callee": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -622,7 +727,10 @@ } }, "optional": false, - "range": [47, 56], + "range": [ + 47, + 56 + ], "loc": { "start": { "line": 2, @@ -634,7 +742,10 @@ } } }, - "range": [39, 56], + "range": [ + 39, + 56 + ], "loc": { "start": { "line": 2, @@ -653,7 +764,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -670,7 +784,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -687,7 +804,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -704,7 +824,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -721,7 +844,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -738,7 +864,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -759,7 +888,10 @@ { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -778,7 +910,10 @@ "name": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -803,7 +938,10 @@ "left": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -820,7 +958,10 @@ "type": "Literal", "raw": "1", "value": 1, - "range": [94, 95], + "range": [ + 94, + 95 + ], "loc": { "start": { "line": 5, @@ -832,7 +973,10 @@ } } }, - "range": [85, 95], + "range": [ + 85, + 95 + ], "loc": { "start": { "line": 5, @@ -844,7 +988,10 @@ } } }, - "range": [85, 96], + "range": [ + 85, + 96 + ], "loc": { "start": { "line": 5, @@ -857,7 +1004,10 @@ } } ], - "range": [81, 99], + "range": [ + 81, + 99 + ], "loc": { "start": { "line": 4, @@ -874,7 +1024,10 @@ "id": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -887,7 +1040,10 @@ } }, "params": [], - "range": [60, 99], + "range": [ + 60, + 99 + ], "loc": { "start": { "line": 4, @@ -906,7 +1062,10 @@ "identifier": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -923,7 +1082,10 @@ "resolved": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -944,7 +1106,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -961,7 +1126,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -978,7 +1146,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -998,7 +1169,10 @@ "identifier": { "type": "Identifier", "name": "increment", - "range": [151, 160], + "range": [ + 151, + 160 + ], "loc": { "start": { "line": 12, @@ -1015,7 +1189,10 @@ "resolved": { "type": "Identifier", "name": "increment", - "range": [69, 78], + "range": [ + 69, + 78 + ], "loc": { "start": { "line": 4, @@ -1045,7 +1222,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -1062,7 +1242,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1082,7 +1265,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [85, 90], + "range": [ + 85, + 90 + ], "loc": { "start": { "line": 5, @@ -1099,7 +1285,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1129,7 +1318,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -1146,7 +1338,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1166,7 +1361,10 @@ "identifier": { "type": "Identifier", "name": "count", - "range": [137, 142], + "range": [ + 137, + 142 + ], "loc": { "start": { "line": 10, @@ -1183,7 +1381,10 @@ "resolved": { "type": "Identifier", "name": "count", - "range": [39, 44], + "range": [ + 39, + 44 + ], "loc": { "start": { "line": 2, @@ -1204,7 +1405,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -1228,7 +1432,10 @@ "identifier": { "type": "Identifier", "name": "$state", - "range": [47, 53], + "range": [ + 47, + 53 + ], "loc": { "start": { "line": 2, @@ -1248,4 +1455,4 @@ } ], "through": [] -} +} \ No newline at end of file From d31e2fadb132055cbe9913b85888eaef450359a5 Mon Sep 17 00:00:00 2001 From: ota-meshi Date: Fri, 17 Nov 2023 15:34:09 +0900 Subject: [PATCH 10/15] fix --- src/context/index.ts | 59 +- src/parser/analyze-scope.ts | 3 +- src/parser/globals.ts | 6 +- src/parser/index.ts | 47 +- src/parser/parser-options.ts | 99 ++ src/parser/resolve-parser.ts | 8 +- src/parser/script.ts | 9 +- src/parser/template.ts | 3 +- src/parser/typescript/analyze/index.ts | 254 +-- src/parser/typescript/index.ts | 27 +- .../universal-reactivity/03-ts-output.json | 1258 +-------------- .../03-ts-scope-output.json | 1426 +---------------- .../03-ts-type-output.svelte.ts | 14 +- tests/src/parser/test-utils.ts | 14 +- tests/src/parser/typescript/index.ts | 16 +- 15 files changed, 331 insertions(+), 2912 deletions(-) create mode 100644 src/parser/parser-options.ts diff --git a/src/context/index.ts b/src/context/index.ts index 66168e1c..4b061b5e 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -1,5 +1,3 @@ -import fs from "fs"; -import path from "path"; import type { Comment, Locations, @@ -15,19 +13,13 @@ import type ESTree from "estree"; import type * as SvAST from "../parser/svelte-ast-types"; import { ScriptLetContext } from "./script-let"; import { LetDirectiveCollections } from "./let-directive-collection"; -import { getParserForLang } from "../parser/resolve-parser"; import type { AttributeToken } from "../parser/html"; import { parseAttributes } from "../parser/html"; -import { - isTSESLintParserObject, - maybeTSESLintParserObject, -} from "../parser/parser-object"; import { sortedLastIndex } from "../utils"; - -const TS_PARSER_NAMES = [ - "@typescript-eslint/parser", - "typescript-eslint-parser-for-extra-files", -]; +import { + isTypeScript, + type NormalizedParserOptions, +} from "../parser/parser-options"; export class ScriptsSourceCode { private raw: string; @@ -116,7 +108,7 @@ export type ContextSourceCode = { export class Context { public readonly code: string; - public readonly parserOptions: any; + public readonly parserOptions: NormalizedParserOptions; // ----- Source Code ------ public readonly sourceCode: ContextSourceCode; @@ -155,7 +147,7 @@ export class Context { private readonly blocks: Block[] = []; - public constructor(code: string, parserOptions: any) { + public constructor(code: string, parserOptions: NormalizedParserOptions) { this.code = code; this.parserOptions = parserOptions; this.locs = new LinesAndColumns(code); @@ -287,44 +279,7 @@ export class Context { return this.state.isTypeScript; } const lang = this.sourceCode.scripts.attrs.lang; - if (!lang) { - return (this.state.isTypeScript = false); - } - const parserValue = getParserForLang( - this.sourceCode.scripts.attrs, - this.parserOptions?.parser, - ); - if (typeof parserValue !== "string") { - return (this.state.isTypeScript = - maybeTSESLintParserObject(parserValue) || - isTSESLintParserObject(parserValue)); - } - const parserName = parserValue; - if (TS_PARSER_NAMES.includes(parserName)) { - return (this.state.isTypeScript = true); - } - if (TS_PARSER_NAMES.some((nm) => parserName.includes(nm))) { - let targetPath = parserName; - while (targetPath) { - const pkgPath = path.join(targetPath, "package.json"); - if (fs.existsSync(pkgPath)) { - try { - return (this.state.isTypeScript = TS_PARSER_NAMES.includes( - JSON.parse(fs.readFileSync(pkgPath, "utf-8"))?.name, - )); - } catch { - return (this.state.isTypeScript = false); - } - } - const parent = path.dirname(targetPath); - if (targetPath === parent) { - break; - } - targetPath = parent; - } - } - - return (this.state.isTypeScript = false); + return (this.state.isTypeScript = isTypeScript(this.parserOptions, lang)); } public stripScriptCode(start: number, end: number): void { diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts index d42b4fca..b6f35935 100644 --- a/src/parser/analyze-scope.ts +++ b/src/parser/analyze-scope.ts @@ -5,12 +5,13 @@ import { getFallbackKeys } from "../traverse"; import type { SvelteReactiveStatement, SvelteScriptElement } from "../ast"; import { addReference, addVariable } from "../scope"; import { addElementToSortedArray } from "../utils"; +import type { NormalizedParserOptions } from "./parser-options"; /** * Analyze scope */ export function analyzeScope( node: ESTree.Node, - parserOptions: any = {}, + parserOptions: NormalizedParserOptions, ): ScopeManager { const ecmaVersion = parserOptions.ecmaVersion || 2020; const ecmaFeatures = parserOptions.ecmaFeatures || {}; diff --git a/src/parser/globals.ts b/src/parser/globals.ts index c406569d..aa3a2ea6 100644 --- a/src/parser/globals.ts +++ b/src/parser/globals.ts @@ -1,10 +1,6 @@ import { svelteVersion } from "./svelte-version"; -const globalsForSvelte4: Readonly = [ - "$$slots", - "$$props", - "$$restProps", -] as const; +const globalsForSvelte4 = ["$$slots", "$$props", "$$restProps"] as const; export const globalsForRunes = [ "$state", "$derived", diff --git a/src/parser/index.ts b/src/parser/index.ts index 96816657..159daa99 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -20,7 +20,7 @@ import { analyzeStoreScope, } from "./analyze-scope"; import { ParseError } from "../errors"; -import { parseTypeScript } from "./typescript"; +import { parseTypeScript, parseTypeScriptInSvelte } from "./typescript"; import { addReference } from "../scope"; import { parseStyleContext, @@ -34,6 +34,8 @@ import { } from "./style-context"; import { globals, globalsForSvelteScript } from "./globals"; import { svelteVersion } from "./svelte-version"; +import type { NormalizedParserOptions } from "./parser-options"; +import { isTypeScript, normalizeParserOptions } from "./parser-options"; export { StyleContext, @@ -111,7 +113,7 @@ function parseAsSvelte( const scripts = ctx.sourceCode.scripts; const resultScript = ctx.isTypeScript() - ? parseTypeScript( + ? parseTypeScriptInSvelte( scripts.getCurrentVirtualCodeInfo(), scripts.attrs, parserOptions, @@ -231,8 +233,10 @@ function parseAsScript( code: string, parserOptions: NormalizedParserOptions, ): ParseResult { - const lang = parserOptions.filePath?.split(".").pop() || "js"; - const resultScript = parseScript(code, { lang }, parserOptions); + const lang = parserOptions.filePath?.split(".").pop(); + const resultScript = isTypeScript(parserOptions, lang) + ? parseTypeScript(code, { lang }, parserOptions) + : parseScript(code, { lang }, parserOptions); // Add $$xxx variable const globalScope = resultScript.scopeManager!.globalScope; @@ -263,41 +267,6 @@ function parseAsScript( return resultScript as any; } -type NormalizedParserOptions = { - ecmaVersion: number | "latest"; - sourceType: "module" | "script"; - loc: boolean; - range: boolean; - raw: boolean; - tokens: boolean; - comment: boolean; - eslintVisitorKeys: boolean; - eslintScopeManager: boolean; - filePath?: string; -}; - -/** Normalize parserOptions */ -function normalizeParserOptions(options: any): NormalizedParserOptions { - const parserOptions = { - ecmaVersion: 2020, - sourceType: "module", - loc: true, - range: true, - raw: true, - tokens: true, - comment: true, - eslintVisitorKeys: true, - eslintScopeManager: true, - ...(options || {}), - }; - parserOptions.sourceType = "module"; - if (parserOptions.ecmaVersion <= 5 || parserOptions.ecmaVersion == null) { - parserOptions.ecmaVersion = 2015; - } - - return parserOptions; -} - /** Extract tokens */ function extractTokens(ctx: Context) { const useRanges = sortNodes([...ctx.tokens, ...ctx.comments]).map( diff --git a/src/parser/parser-options.ts b/src/parser/parser-options.ts new file mode 100644 index 00000000..6f134ced --- /dev/null +++ b/src/parser/parser-options.ts @@ -0,0 +1,99 @@ +import fs from "fs"; +import path from "path"; +import { + isTSESLintParserObject, + maybeTSESLintParserObject, +} from "./parser-object"; +import { getParserForLang, type UserOptionParser } from "./resolve-parser"; + +export type NormalizedParserOptions = { + parser?: UserOptionParser; + project?: string | string[] | null; + + ecmaVersion: number | "latest"; + sourceType: "module" | "script"; + ecmaFeatures?: { + globalReturn?: boolean | undefined; + impliedStrict?: boolean | undefined; + jsx?: boolean | undefined; + experimentalObjectRestSpread?: boolean | undefined; + [key: string]: any; + }; + loc: boolean; + range: boolean; + raw: boolean; + tokens: boolean; + comment: boolean; + eslintVisitorKeys: boolean; + eslintScopeManager: boolean; + filePath?: string; +}; + +/** Normalize parserOptions */ +export function normalizeParserOptions(options: any): NormalizedParserOptions { + const parserOptions = { + ecmaVersion: 2020, + sourceType: "module", + loc: true, + range: true, + raw: true, + tokens: true, + comment: true, + eslintVisitorKeys: true, + eslintScopeManager: true, + ...(options || {}), + }; + parserOptions.sourceType = "module"; + if (parserOptions.ecmaVersion <= 5 || parserOptions.ecmaVersion == null) { + parserOptions.ecmaVersion = 2015; + } + + return parserOptions; +} + +const TS_PARSER_NAMES = [ + "@typescript-eslint/parser", + "typescript-eslint-parser-for-extra-files", +]; + +export function isTypeScript( + parserOptions: NormalizedParserOptions, + lang: string | undefined, +): boolean { + if (!lang) { + return false; + } + const parserValue = getParserForLang(lang, parserOptions?.parser); + if (typeof parserValue !== "string") { + return ( + maybeTSESLintParserObject(parserValue) || + isTSESLintParserObject(parserValue) + ); + } + const parserName = parserValue; + if (TS_PARSER_NAMES.includes(parserName)) { + return true; + } + if (TS_PARSER_NAMES.some((nm) => parserName.includes(nm))) { + let targetPath = parserName; + while (targetPath) { + const pkgPath = path.join(targetPath, "package.json"); + if (fs.existsSync(pkgPath)) { + try { + return TS_PARSER_NAMES.includes( + JSON.parse(fs.readFileSync(pkgPath, "utf-8"))?.name, + ); + } catch { + return false; + } + } + const parent = path.dirname(targetPath); + if (targetPath === parent) { + break; + } + targetPath = parent; + } + } + + return false; +} diff --git a/src/parser/resolve-parser.ts b/src/parser/resolve-parser.ts index 3cc2c1dd..9dab4de1 100644 --- a/src/parser/resolve-parser.ts +++ b/src/parser/resolve-parser.ts @@ -2,7 +2,7 @@ import { getEspree } from "./espree"; import type { ParserObject } from "./parser-object"; import { isParserObject } from "./parser-object"; -type UserOptionParser = +export type UserOptionParser = | string | ParserObject | Record @@ -10,7 +10,7 @@ type UserOptionParser = /** Get parser for script lang */ export function getParserForLang( - attrs: Record, + lang: string | undefined | null, parser: UserOptionParser, ): string | ParserObject { if (parser) { @@ -18,7 +18,7 @@ export function getParserForLang( return parser; } if (typeof parser === "object") { - const value = parser[attrs.lang || "js"]; + const value = parser[lang || "js"]; if (typeof value === "string" || isParserObject(value)) { return value; } @@ -32,7 +32,7 @@ export function getParser( attrs: Record, parser: UserOptionParser, ): ParserObject { - const parserValue = getParserForLang(attrs, parser); + const parserValue = getParserForLang(attrs.lang, parser); if (isParserObject(parserValue)) { return parserValue; } diff --git a/src/parser/script.ts b/src/parser/script.ts index 17e375a7..80de7662 100644 --- a/src/parser/script.ts +++ b/src/parser/script.ts @@ -3,6 +3,7 @@ import { analyzeScope } from "./analyze-scope"; import { traverseNodes } from "../traverse"; import { getParser } from "./resolve-parser"; import { isEnhancedParserObject } from "./parser-object"; +import type { NormalizedParserOptions } from "./parser-options"; /** * Parse for