diff --git a/.changeset/new-ways-mix.md b/.changeset/new-ways-mix.md new file mode 100644 index 00000000..21a50da1 --- /dev/null +++ b/.changeset/new-ways-mix.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: add support for $host and $state.snapshot diff --git a/.changeset/violet-adults-knock.md b/.changeset/violet-adults-knock.md new file mode 100644 index 00000000..f8bbc1cf --- /dev/null +++ b/.changeset/violet-adults-knock.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: update svelte to 5.0.0-next.115 && minor refactor diff --git a/package.json b/package.json index e1532316..b9177518 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "version:ci": "env-cmd -e version-ci pnpm run build:meta && changeset version" }, "peerDependencies": { - "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.112" + "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.115" }, "peerDependenciesMeta": { "svelte": { @@ -68,16 +68,16 @@ "@ota-meshi/eslint-plugin": "^0.15.3", "@types/benchmark": "^2.1.5", "@types/chai": "^4.3.14", - "@types/eslint": "^8.56.7", + "@types/eslint": "^8.56.10", "@types/eslint-scope": "^3.7.7", "@types/eslint-visitor-keys": "^3.3.0", "@types/estree": "^1.0.5", "@types/mocha": "^10.0.6", - "@types/node": "^20.12.5", + "@types/node": "^20.12.7", "@types/semver": "^7.5.8", - "@typescript-eslint/eslint-plugin": "^7.5.0", - "@typescript-eslint/parser": "~7.7.0", - "@typescript-eslint/types": "~7.7.0", + "@typescript-eslint/eslint-plugin": "^7.7.1", + "@typescript-eslint/parser": "~7.7.1", + "@typescript-eslint/types": "~7.7.1", "benchmark": "^2.1.4", "chai": "^4.4.1", "env-cmd": "^10.1.0", @@ -87,27 +87,27 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-json-schema-validator": "^5.1.0", - "eslint-plugin-jsonc": "^2.15.0", - "eslint-plugin-n": "^17.0.0", + "eslint-plugin-jsonc": "^2.15.1", + "eslint-plugin-n": "^17.3.1", "eslint-plugin-node-dependencies": "^0.12.0", "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-regexp": "^2.4.0", - "eslint-plugin-svelte": "^2.35.1", + "eslint-plugin-regexp": "^2.5.0", + "eslint-plugin-svelte": "^2.38.0", "eslint-plugin-yml": "^1.14.0", "estree-walker": "^3.0.3", "locate-character": "^3.0.0", - "magic-string": "^0.30.9", + "magic-string": "^0.30.10", "mocha": "^10.4.0", "mocha-chai-jest-snapshot": "^1.1.4", "nyc": "^15.1.0", "prettier": "~3.2.5", "prettier-plugin-pkg": "^0.18.1", - "prettier-plugin-svelte": "^3.2.2", + "prettier-plugin-svelte": "^3.2.3", "rimraf": "^5.0.5", "semver": "^7.6.0", - "svelte": "^5.0.0-next.112", - "svelte2tsx": "^0.7.6", - "typescript": "~5.4.4", + "svelte": "^5.0.0-next.115", + "svelte2tsx": "^0.7.7", + "typescript": "~5.4.5", "typescript-eslint-parser-for-extra-files": "^0.6.0" }, "publishConfig": { diff --git a/src/parser/compat.ts b/src/parser/compat.ts index 0a7a11ce..9b00ff1f 100644 --- a/src/parser/compat.ts +++ b/src/parser/compat.ts @@ -2,7 +2,6 @@ import type ESTree from "estree"; import type * as SvAST from "./svelte-ast-types"; import type * as Compiler from "svelte/compiler"; -import { parseAttributes } from "./html"; export type Child = | Compiler.Text @@ -31,16 +30,22 @@ export function getModuleFromRoot( } export function getOptionsFromRoot( svelteAst: Compiler.Root | SvAST.AstLegacy, - code: string, ): Compiler.SvelteOptionsRaw | null { const root = svelteAst as Compiler.Root; if (root.options) { - if ((root.options as any).__raw__) { - return (root.options as any).__raw__; - } - // If there is no `__raw__` property in the `SvelteOptions` node, - // we will parse `` ourselves. - return parseSvelteOptions(root.options, code); + return { + type: "SvelteOptions", + name: "svelte:options", + attributes: root.options.attributes, + fragment: { + type: "Fragment", + nodes: [], + transparent: true, + }, + start: root.options.start, + end: root.options.end, + parent: null as any, + }; } return null; } @@ -239,40 +244,3 @@ export function getDeclaratorFromConstTag( (node as SvAST.ConstTag).expression ); } - -function parseSvelteOptions( - options: Compiler.SvelteOptions, - code: string, -): Compiler.SvelteOptionsRaw { - const { start, end } = options; - const nameEndName = start + "", tagEndIndex)) { - const childEndIndex = code.indexOf("(initial: T): T", @@ -328,9 +329,12 @@ function analyzeRuneVariables( "export function frozen(initial: T): Readonly;", "export function frozen(): Readonly | undefined;", ]); + appendDeclareNamespaceVirtualScripts(globalName, [ + "export function snapshot(state: T): T;", + ]); break; } - // See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2535 + // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2648 case "$derived": { appendDeclareFunctionVirtualScripts(globalName, [ "(expression: T): T", @@ -340,7 +344,7 @@ function analyzeRuneVariables( ]); break; } - // See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2574 + // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2687 case "$effect": { appendDeclareFunctionVirtualScripts(globalName, [ "(fn: () => void | (() => void)): void", @@ -352,23 +356,30 @@ function analyzeRuneVariables( ]); break; } - // See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2655 + // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2768 case "$props": { appendDeclareFunctionVirtualScripts(globalName, ["(): any"]); break; } - // See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2666 + // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2779 case "$bindable": { appendDeclareFunctionVirtualScripts(globalName, ["(t?: T): T"]); break; } - // See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2686 + // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2799 case "$inspect": { appendDeclareFunctionVirtualScripts(globalName, [ `(...values: T): { with: (fn: (type: 'init' | 'update', ...values: T) => void) => void }`, ]); break; } + // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2822 + case "$host": { + appendDeclareFunctionVirtualScripts(globalName, [ + `(): El`, + ]); + break; + } default: { const _: never = globalName; throw Error(`Unknown global: ${_}`); diff --git a/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json b/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json index d13c2860..d82fbc80 100644 --- a/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json index 39b2e4c4..621e4531 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json index 1b74fba7..09804eab 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json b/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json index f1ff0258..b292c97e 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json index 94f36bf8..d658e676 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json @@ -124,6 +124,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json index 200d90d6..87224c22 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json index a06baacb..4ffe7c95 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json @@ -126,6 +126,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json index 3778f48c..ea7be21c 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json @@ -125,6 +125,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json index adcd7a8a..504e7aff 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json @@ -125,6 +125,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json index 76f0ca39..871d831d 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json index 909037e0..6acdb94d 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json index 4c830220..3f6472f4 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json @@ -125,6 +125,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-scope-output.json index c05d83f1..eec6f31b 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-frozen-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json index b456bc01..993e5812 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json index abe0cb6b..25cc21d2 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/02-2-$derived-by-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/02-2-$derived-by-scope-output.json index 8cc7c8a3..34bd2f2e 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/02-2-$derived-by-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/02-2-$derived-by-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json index 98b9012f..4bfc8366 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json @@ -126,6 +126,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json index 9bd952ca..33c28821 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json index e02632de..5fec6ab3 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json index b8db2a2d..f5be5a9e 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json index 2b43d00d..ab73dd96 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json index 464a2b2e..4ccb3687 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/08-2-$bindable-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/08-2-$bindable-scope-output.json index 16502557..e12c25b3 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/08-2-$bindable-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/08-2-$bindable-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/08-3-$bindable-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/08-3-$bindable-scope-output.json index 6edb3386..776375d6 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/08-3-$bindable-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/08-3-$bindable-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/08-4-$bindable-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/08-4-$bindable-ts-scope-output.json index a07dab4f..834afcef 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/08-4-$bindable-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/08-4-$bindable-ts-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json index 970e1fce..903bfef3 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-scope-output.json index e3dbd37c..a67eae9f 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-scope-output.json @@ -125,6 +125,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-scope-output.json index daadb792..99fee2b5 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-scope-output.json @@ -125,6 +125,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-scope-output.json index 6ccb02bb..d96a8c8b 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-scope-output.json @@ -125,6 +125,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-scope-output.json index 5b47930a..0ea874f8 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-scope-output.json @@ -102,6 +102,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-scope-output.json index 28f956da..7e3e51cb 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-scope-output.json @@ -102,6 +102,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-scope-output.json index 93ab807d..79b34417 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-scope-output.json @@ -102,6 +102,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-scope-output.json index f7dc7cbe..549490c3 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-scope-output.json @@ -102,6 +102,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-scope-output.json index fb98f24c..332d34e7 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-scope-output.json @@ -102,6 +102,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-scope-output.json index 805d424c..3f602772 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-scope-output.json @@ -102,6 +102,12 @@ "resolved": null } ] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json index 50dbd80d..7cafcb8a 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json index 579cb5ae..3141568c 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json index 307e63ec..16709108 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json index 22240395..103500fe 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json index 5dfb22f6..030efdbe 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json index 27a14e34..19daf8f9 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json index a5cbac2e..44953fc4 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json index ac3a5490..c58409d7 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json index 90d333c7..9775c177 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json index fba3285e..043beece 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json index 53a8cf5a..196ed04a 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json index 6bbe4108..06cfeb93 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json index b2cc83b0..ea5ffa87 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json index 8675e7db..3664b1c3 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 @@ -60,6 +60,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json index 8675e7db..3664b1c3 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 @@ -60,6 +60,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json b/tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json index d17e83d8..a4c210b5 100644 --- a/tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/generics01-snippets-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/render01-scope-output.json b/tests/fixtures/parser/ast/svelte5/render01-scope-output.json index 71189aaf..f5b930c7 100644 --- a/tests/fixtures/parser/ast/svelte5/render01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/render01-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/render02-optional-scope-output.json b/tests/fixtures/parser/ast/svelte5/render02-optional-scope-output.json index b35b3e02..6dfc02cd 100644 --- a/tests/fixtures/parser/ast/svelte5/render02-optional-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/render02-optional-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/snippet01-hoist-scope-output.json b/tests/fixtures/parser/ast/svelte5/snippet01-hoist-scope-output.json index bed2e06f..46221343 100644 --- a/tests/fixtures/parser/ast/svelte5/snippet01-hoist-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/snippet01-hoist-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/svelte-options01-input.svelte b/tests/fixtures/parser/ast/svelte5/svelte-options01-input.svelte new file mode 100644 index 00000000..c20f843d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/svelte-options01-input.svelte @@ -0,0 +1 @@ + diff --git a/tests/fixtures/parser/ast/svelte5/svelte-options01-output.json b/tests/fixtures/parser/ast/svelte5/svelte-options01-output.json new file mode 100644 index 00000000..b88cab2d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/svelte-options01-output.json @@ -0,0 +1,388 @@ +{ + "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": false, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "children": [], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 30, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "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": "Punctuator", + "value": "/", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:options", + "range": [ + 32, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/svelte-options01-scope-output.json b/tests/fixtures/parser/ast/svelte5/svelte-options01-scope-output.json new file mode 100644 index 00000000..903bfef3 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/svelte-options01-scope-output.json @@ -0,0 +1,76 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json b/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json index 52c8191f..2ba07c8e 100644 --- a/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json @@ -84,6 +84,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json b/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json index ecea58e6..b90ee39e 100644 --- a/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json @@ -108,6 +108,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json b/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json index 402f4917..5ae4fb02 100644 --- a/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json @@ -60,6 +60,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$derived-by01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$derived-by01-scope-output.json index b0a5aaec..1857d2ed 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$derived-by01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$derived-by01-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json index 01740936..17733500 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json @@ -102,6 +102,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json index cfdb17bc..8fa42ddd 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json @@ -126,6 +126,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json index 25f2ab37..14595fc5 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json @@ -126,6 +126,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json index 09a60632..db0b50dd 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-scope-output.json index db6325ed..0c9d2daf 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$state-flozen01-scope-output.json @@ -101,6 +101,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json index de240e41..1a7ae2c2 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json @@ -101,6 +101,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json index 4cef454c..4c71dec6 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json index 517f37b7..70b42710 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json index 82ea3206..ee03f30f 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json index 5e0173a6..124a9e45 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json index d885356d..80fd88c1 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json index ff10f037..e8881e96 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json index c6101845..2e9e5aa6 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json index b5d5e558..3b00eb5f 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json @@ -78,6 +78,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json index c31e2244..58054a7f 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-snippet02-hoist-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-snippet02-hoist-scope-output.json index af808178..dbe27059 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-snippet02-hoist-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-snippet02-hoist-scope-output.json @@ -54,6 +54,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json index 2a684a4b..9d38d2a1 100644 --- a/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json @@ -101,6 +101,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json index 657c2e22..02a5ccfc 100644 --- a/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json index 657c2e22..02a5ccfc 100644 --- a/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json index 657c2e22..02a5ccfc 100644 --- a/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json index 657c2e22..02a5ccfc 100644 --- a/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json @@ -77,6 +77,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json b/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json index 57c5d830..177dfbd8 100644 --- a/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json @@ -100,6 +100,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/src/parser/test-utils.ts b/tests/src/parser/test-utils.ts index f72c79d5..ec68fec6 100644 --- a/tests/src/parser/test-utils.ts +++ b/tests/src/parser/test-utils.ts @@ -81,6 +81,12 @@ const SVELTE5_SCOPE_VARIABLES_BASE = [ defs: [], references: [], }, + { + name: "$host", + identifiers: [], + defs: [], + references: [], + }, ]; export function generateParserOptions( ...options: Linter.ParserOptions[]