diff --git a/.github/workflows/GHPages.yml b/.github/workflows/GHPages.yml
index c0a73137..a326867e 100644
--- a/.github/workflows/GHPages.yml
+++ b/.github/workflows/GHPages.yml
@@ -25,7 +25,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- name: Install And Build
run: |+
diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml
index 8eb55fc1..70490c12 100644
--- a/.github/workflows/NodeCI.yml
+++ b/.github/workflows/NodeCI.yml
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- name: Install Packages
run: pnpm install
@@ -26,7 +26,7 @@ jobs:
node-version: [18.x, 20.x, 22.x, latest]
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
@@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- name: Use Node.js
uses: actions/setup-node@v4
- name: Install Packages
@@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- name: Use Node.js
uses: actions/setup-node@v4
- name: Install Svelte v4
@@ -70,7 +70,7 @@ jobs:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
@@ -87,7 +87,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- name: Install Packages
run: pnpm install
@@ -101,7 +101,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- name: Install Packages
run: pnpm install
diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml
index 5c8fefa8..5aa84503 100644
--- a/.github/workflows/Release.yml
+++ b/.github/workflows/Release.yml
@@ -22,7 +22,7 @@ jobs:
fetch-depth: 0
- name: Setup pnpm
- uses: pnpm/action-setup@v2
+ uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index c0b82e21..1e60d6a8 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- name: Install Packages
run: pnpm install
diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml
index 20d5d4aa..27864d31 100644
--- a/.github/workflows/pkg.pr.new.yml
+++ b/.github/workflows/pkg.pr.new.yml
@@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- - uses: pnpm/action-setup@v2
+ - uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- name: Install Packages
run: pnpm install
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 00000000..44e54133
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1 @@
+tests/fixtures
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 00000000..877131f6
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,3 @@
+{
+ "plugins": ["prettier-plugin-pkg", "prettier-plugin-svelte"]
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0640c7b..7d6479ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
# svelte-eslint-parser
+## 1.1.3
+
+### Patch Changes
+
+- [#704](https://github.com/sveltejs/svelte-eslint-parser/pull/704) [`0436da6`](https://github.com/sveltejs/svelte-eslint-parser/commit/0436da6b7190208284de45ce7a54e18c4d31c032) Thanks [@mcous](https://github.com/mcous)! - Strip `projectService` from TS options when type information not needed
+
+## 1.1.2
+
+### Patch Changes
+
+- [#698](https://github.com/sveltejs/svelte-eslint-parser/pull/698) [`8188302`](https://github.com/sveltejs/svelte-eslint-parser/commit/81883020381ddef27490ddc27ea719135abee89e) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: crash with `$derived()` in template using ts
+
+## 1.1.1
+
+### Patch Changes
+
+- [#692](https://github.com/sveltejs/svelte-eslint-parser/pull/692) [`1c533d8`](https://github.com/sveltejs/svelte-eslint-parser/commit/1c533d8929c57f3bba5e97bc4d1aee06ddd9cdd0) Thanks [@baseballyama](https://github.com/baseballyama)! - fix: resolved issue of `$props` incorrectly detected as store when using variables named after runes like `$props` and `props`
+
## 1.1.0
### Minor Changes
diff --git a/benchmark/index.ts b/benchmark/index.ts
index 6e23c845..38ff0001 100644
--- a/benchmark/index.ts
+++ b/benchmark/index.ts
@@ -1,12 +1,15 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -- ignore
/* eslint-disable no-console -- ignore */
-import * as Benchmark from "benchmark";
-import fs from "fs";
-import { parseForESLint } from "../src/index.js";
+import Benchmark from "benchmark";
+import fs from "node:fs";
+import { fileURLToPath } from "node:url";
import { parseForESLint as parseOld } from "../node_modules/svelte-eslint-parser/lib/index.js";
+import { parseForESLint } from "../src/index.js";
const contents = `${fs.readFileSync(
- require.resolve("../explorer-v2/src/lib/RulesSettings.svelte"),
+ fileURLToPath(
+ import.meta.resolve("../explorer-v2/src/lib/RulesSettings.svelte"),
+ ),
"utf-8",
)}// comments`;
diff --git a/docs/AST.md b/docs/AST.md
index b8eec7b4..c0f90492 100644
--- a/docs/AST.md
+++ b/docs/AST.md
@@ -15,7 +15,7 @@ See [ESTree] for the AST node of the script generated by `espree`.
[variabledeclarator]: https://github.com/estree/estree/blob/master/es5.md#variabledeclarator
[pattern]: https://github.com/estree/estree/blob/master/es5.md#patterns
-See details: [../src/ast/*](../src/ast/)
+See details: [../src/ast/\*](../src/ast/)
## Common
diff --git a/docs/internal-mechanism.md b/docs/internal-mechanism.md
index 9cc25972..80fead11 100644
--- a/docs/internal-mechanism.md
+++ b/docs/internal-mechanism.md
@@ -38,23 +38,26 @@ For example, if you enter `*.svelte` template to listen for input events:
```svelte
-
+
+
```
Parse the following virtual script code as a script:
```ts
-
- function inputHandler () {
- // process
- }
-;function $_render1(){
-
-(inputHandler) as ((e:'input' extends keyof HTMLElementEventMap ? HTMLElementEventMap['input'] : CustomEvent) => void );
+function inputHandler() {
+ // process
+}
+function $_render1() {
+ inputHandler as (
+ e: "input" extends keyof HTMLElementEventMap
+ ? HTMLElementEventMap["input"]
+ : CustomEvent,
+ ) => void;
}
```
@@ -78,25 +81,24 @@ For example, when using `{#each}` and `{@const}`:
```svelte
+
{#each array as e}
- {@const ee = e * 2}
- {ee}
+ {@const ee = e * 2}
+ {ee}
{/each}
```
Parse the following virtual script code as a script:
```ts
-
- const array = [1, 2, 3]
-;function $_render1(){
-
-Array.from(array).forEach((e) => {
+const array = [1, 2, 3];
+function $_render1() {
+ Array.from(array).forEach((e) => {
const ee = e * 2;
- (ee);
-});
+ ee;
+ });
}
```
@@ -121,8 +123,9 @@ TypeScript's type inference is pretty good, so parsing Svelte as-is gives some w
e.g.
+
```ts
-export let foo: { bar: number } | null = null
+export let foo: { bar: number } | null = null;
$: console.log(foo && foo.bar);
// ^ never type
@@ -139,13 +142,13 @@ For example:
```svelte
{foo && foo.bar}
@@ -154,26 +157,24 @@ $: ({ bar: n } = foo || { bar: 42 });
Parse the following virtual script code as a script:
```ts
-
-export let foo: { bar: number } | null = null
+export let foo: { bar: number } | null = null;
-$: function $_reactiveStatementScopeFunction1(){
- console.log(foo && foo.bar);
+$: function $_reactiveStatementScopeFunction1() {
+ console.log(foo && foo.bar);
}
-$: let r =$_reactiveVariableScopeFunction2();
-function $_reactiveVariableScopeFunction2(){
- let $_tmpVar3;
- return ($_tmpVar3 = foo && foo.bar);
+$: let r = $_reactiveVariableScopeFunction2();
+function $_reactiveVariableScopeFunction2() {
+ let $_tmpVar3;
+ return ($_tmpVar3 = foo && foo.bar);
}
-$: let { bar: n } =$_reactiveVariableScopeFunction4();
-function $_reactiveVariableScopeFunction4(){
- let $_tmpVar5;
- return ($_tmpVar5 = foo || { bar: 42 });
+$: let { bar: n } = $_reactiveVariableScopeFunction4();
+function $_reactiveVariableScopeFunction4() {
+ let $_tmpVar5;
+ return ($_tmpVar5 = foo || { bar: 42 });
}
-;function $_render6(){
-
-(foo && foo.bar);
+function $_render6() {
+ foo && foo.bar;
}
```
diff --git a/explorer-v2/src/lib/AstExplorer.svelte b/explorer-v2/src/lib/AstExplorer.svelte
index 66ff7746..53191731 100644
--- a/explorer-v2/src/lib/AstExplorer.svelte
+++ b/explorer-v2/src/lib/AstExplorer.svelte
@@ -29,19 +29,20 @@
);
let tsParser = undefined;
+ function setTSParser(parser) {
+ if (typeof window !== 'undefined') {
+ if (!window.process) {
+ window.process = {
+ cwd: () => '',
+ env: {}
+ };
+ }
+ }
+ tsParser = parser;
+ }
$: {
if (hasLangTs && !tsParser) {
- import('@typescript-eslint/parser').then((parser) => {
- if (typeof window !== 'undefined') {
- if (!window.process) {
- window.process = {
- cwd: () => '',
- env: {}
- };
- }
- }
- tsParser = parser;
- });
+ import('@typescript-eslint/parser').then(setTSParser);
}
}
diff --git a/explorer-v2/src/lib/ESLintPlayground.svelte b/explorer-v2/src/lib/ESLintPlayground.svelte
index 6905ab06..dacaa2d3 100644
--- a/explorer-v2/src/lib/ESLintPlayground.svelte
+++ b/explorer-v2/src/lib/ESLintPlayground.svelte
@@ -34,19 +34,20 @@
$: hasLangTs = /lang\s*=\s*(?:"ts"|ts|'ts'|"typescript"|typescript|'typescript')/u.test(code);
let tsParser = undefined;
+ function setTSParser(parser) {
+ if (typeof window !== 'undefined') {
+ if (!window.process) {
+ window.process = {
+ cwd: () => '',
+ env: {}
+ };
+ }
+ }
+ tsParser = parser;
+ }
$: {
if (hasLangTs && !tsParser) {
- import('@typescript-eslint/parser').then((parser) => {
- if (typeof window !== 'undefined') {
- if (!window.process) {
- window.process = {
- cwd: () => '',
- env: {}
- };
- }
- }
- tsParser = parser;
- });
+ import('@typescript-eslint/parser').then(setTSParser);
}
}
diff --git a/explorer-v2/src/lib/MonacoEditor.svelte b/explorer-v2/src/lib/MonacoEditor.svelte
index 97246e99..3db6ffa5 100644
--- a/explorer-v2/src/lib/MonacoEditor.svelte
+++ b/explorer-v2/src/lib/MonacoEditor.svelte
@@ -54,22 +54,7 @@
$: {
disposeCodeActionProvider();
if (provideCodeActions) {
- loadingMonaco.then((monaco) => {
- codeActionProviderDisposable = monaco.languages.registerCodeActionProvider(language, {
- provideCodeActions(model, range, context) {
- const editor = getLeftEditor?.();
- if (editor?.getModel().url !== model.url) {
- return {
- actions: [],
- dispose() {
- /* nop */
- }
- };
- }
- return provideCodeActions(model, range, context);
- }
- });
- });
+ loadingMonaco.then((monaco) => setupCodeActionProvider(monaco, provideCodeActions));
}
}
@@ -216,6 +201,22 @@
}
}
+ function setupCodeActionProvider(monaco, provideCodeActions) {
+ codeActionProviderDisposable = monaco.languages.registerCodeActionProvider(language, {
+ provideCodeActions(model, range, context) {
+ const editor = getLeftEditor?.();
+ if (editor?.getModel().url !== model.url) {
+ return {
+ actions: [],
+ dispose() {
+ /* nop */
+ }
+ };
+ }
+ return provideCodeActions(model, range, context);
+ }
+ });
+ }
function disposeCodeActionProvider() {
if (codeActionProviderDisposable) {
codeActionProviderDisposable.dispose();
diff --git a/explorer-v2/src/lib/ScopeExplorer.svelte b/explorer-v2/src/lib/ScopeExplorer.svelte
index ecf361f8..263661a9 100644
--- a/explorer-v2/src/lib/ScopeExplorer.svelte
+++ b/explorer-v2/src/lib/ScopeExplorer.svelte
@@ -28,19 +28,20 @@
svelteValue
);
let tsParser = undefined;
+ function setTSParser(parser) {
+ if (typeof window !== 'undefined') {
+ if (!window.process) {
+ window.process = {
+ cwd: () => '',
+ env: {}
+ };
+ }
+ }
+ tsParser = parser;
+ }
$: {
if (hasLangTs && !tsParser) {
- import('@typescript-eslint/parser').then((parser) => {
- if (typeof window !== 'undefined') {
- if (!window.process) {
- window.process = {
- cwd: () => '',
- env: {}
- };
- }
- }
- tsParser = parser;
- });
+ import('@typescript-eslint/parser').then(setTSParser);
}
}
$: {
diff --git a/package.json b/package.json
index 7d0c438a..598cf544 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
{
"name": "svelte-eslint-parser",
- "version": "1.1.0",
+ "version": "1.1.3",
+ "type": "module",
"description": "Svelte parser for ESLint",
"repository": "git+https://github.com/sveltejs/svelte-eslint-parser.git",
"homepage": "https://github.com/sveltejs/svelte-eslint-parser#readme",
@@ -14,7 +15,6 @@
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
- "type": "module",
"main": "lib/index.js",
"files": [
"lib"
@@ -40,10 +40,10 @@
"prerelease": "pnpm run clean && pnpm run build",
"preversion": "pnpm run lint && pnpm run test",
"release": "changeset publish",
+ "run-update-fixtures": "pnpm run ts ./tools/update-fixtures.ts",
"test": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"ts": "node --import tsx/esm",
"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"
},
"peerDependencies": {
@@ -63,55 +63,54 @@
"postcss-selector-parser": "^7.0.0"
},
"devDependencies": {
- "@changesets/changelog-github": "^0.5.0",
- "@changesets/cli": "^2.27.10",
- "@changesets/get-release-plan": "^4.0.5",
+ "@changesets/changelog-github": "^0.5.1",
+ "@changesets/cli": "^2.28.1",
+ "@changesets/get-release-plan": "^4.0.8",
"@ota-meshi/eslint-plugin": "^0.17.6",
"@ota-meshi/test-snapshot": "^1.1.0",
"@types/benchmark": "^2.1.5",
- "@types/chai": "^5.0.0",
+ "@types/chai": "^5.2.1",
"@types/eslint": "^9.6.1",
"@types/eslint-scope": "^3.7.7",
"@types/eslint-visitor-keys": "^3.3.2",
- "@types/estree": "^1.0.6",
+ "@types/estree": "^1.0.7",
"@types/mocha": "^10.0.10",
- "@types/node": "^22.10.1",
- "@types/semver": "^7.5.8",
- "@typescript-eslint/eslint-plugin": "^8.16.0",
- "@typescript-eslint/parser": "~8.26.0",
- "@typescript-eslint/types": "~8.26.0",
+ "@types/node": "^22.13.13",
+ "@types/semver": "^7.7.0",
+ "@typescript-eslint/parser": "^8.29.0",
+ "@typescript-eslint/types": "^8.29.0",
"benchmark": "^2.1.4",
- "c8": "^10.1.2",
- "chai": "^5.0.0",
+ "c8": "^10.1.3",
+ "chai": "^5.2.0",
"env-cmd": "^10.1.0",
- "esbuild": "^0.25.0",
- "eslint": "~9.22.0",
- "eslint-config-prettier": "^10.0.0",
+ "esbuild": "^0.25.1",
+ "eslint": "~9.26.0",
+ "eslint-config-prettier": "^10.1.1",
"eslint-plugin-eslint-comments": "^3.2.0",
- "eslint-plugin-jsdoc": "^50.6.0",
- "eslint-plugin-json-schema-validator": "^5.2.0",
- "eslint-plugin-jsonc": "^2.18.2",
- "eslint-plugin-n": "^17.14.0",
- "eslint-plugin-node-dependencies": "^0.12.0",
- "eslint-plugin-prettier": "^5.2.1",
+ "eslint-plugin-jsdoc": "^50.6.9",
+ "eslint-plugin-json-schema-validator": "^5.3.1",
+ "eslint-plugin-jsonc": "^2.20.0",
+ "eslint-plugin-n": "^17.17.0",
+ "eslint-plugin-node-dependencies": "^1.0.0",
+ "eslint-plugin-prettier": "^5.2.5",
"eslint-plugin-regexp": "^2.7.0",
- "eslint-plugin-svelte": "^2.46.1",
- "eslint-plugin-yml": "^1.16.0",
+ "eslint-plugin-svelte": "^3.3.3",
+ "eslint-plugin-yml": "^1.17.0",
"globals": "^16.0.0",
"locate-character": "^3.0.0",
- "magic-string": "^0.30.14",
- "mocha": "^11.0.0",
- "prettier": "~3.5.0",
- "prettier-plugin-pkg": "^0.18.1",
- "prettier-plugin-svelte": "^3.3.2",
+ "magic-string": "^0.30.17",
+ "mocha": "^11.1.0",
+ "prettier": "~3.5.3",
+ "prettier-plugin-pkg": "^0.19.0",
+ "prettier-plugin-svelte": "^3.3.3",
"rimraf": "^6.0.1",
- "semver": "^7.6.3",
- "svelte": "^5.9.0",
- "svelte2tsx": "^0.7.28",
- "tsx": "^4.19.2",
- "typescript": "~5.8.0",
- "typescript-eslint": "^8.16.0",
- "typescript-eslint-parser-for-extra-files": "^0.7.0"
+ "semver": "^7.7.1",
+ "svelte": "^5.25.3",
+ "svelte2tsx": "^0.7.35",
+ "tsx": "^4.19.3",
+ "typescript": "~5.8.2",
+ "typescript-eslint": "^8.28.0",
+ "typescript-eslint-parser-for-extra-files": "^0.9.0"
},
"publishConfig": {
"access": "public"
diff --git a/prettier.config.mjs b/prettier.config.mjs
new file mode 100644
index 00000000..ff8b4c56
--- /dev/null
+++ b/prettier.config.mjs
@@ -0,0 +1 @@
+export default {};
diff --git a/src/meta.ts b/src/meta.ts
index 9628bc65..fb51a49d 100644
--- a/src/meta.ts
+++ b/src/meta.ts
@@ -2,4 +2,4 @@
// This file has been automatically generated,
// in order to update its content execute "pnpm run build:meta"
export const name = "svelte-eslint-parser";
-export const version = "1.1.0";
+export const version = "1.1.3";
diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts
index 01fc9ab4..2182f0b0 100644
--- a/src/parser/analyze-scope.ts
+++ b/src/parser/analyze-scope.ts
@@ -16,6 +16,7 @@ import {
import { addElementToSortedArray } from "../utils/index.js";
import type { NormalizedParserOptions } from "./parser-options.js";
import type { SvelteParseContext } from "./svelte-parse-context.js";
+import { getGlobalsForSvelte } from "./globals.js";
/**
* Analyze scope
*/
@@ -105,7 +106,10 @@ export function analyzeReactiveScope(scopeManager: ScopeManager): void {
/**
* Analyze store scope. e.g. $count
*/
-export function analyzeStoreScope(scopeManager: ScopeManager): void {
+export function analyzeStoreScope(
+ scopeManager: ScopeManager,
+ svelteParseContext: SvelteParseContext,
+): void {
const moduleScope = scopeManager.scopes.find(
(scope) => scope.type === "module",
);
@@ -114,8 +118,13 @@ export function analyzeStoreScope(scopeManager: ScopeManager): void {
}
const toBeMarkAsUsedReferences: Reference[] = [];
+ const globals = getGlobalsForSvelte(svelteParseContext);
+
for (const reference of [...scopeManager.globalScope.through]) {
- if (reference.identifier.name.startsWith("$")) {
+ if (
+ reference.identifier.name.startsWith("$") &&
+ !globals.includes(reference.identifier.name as never)
+ ) {
const realName = reference.identifier.name.slice(1);
const variable = moduleScope.set.get(realName);
if (variable) {
diff --git a/src/parser/converts/block.ts b/src/parser/converts/block.ts
index 1d9709da..fc9f3f92 100644
--- a/src/parser/converts/block.ts
+++ b/src/parser/converts/block.ts
@@ -147,17 +147,17 @@ export function convertIfBlock(
});
const consequent = getConsequentFromIfBlock(node);
- ifBlock.children.push(
- ...convertChildren(
- {
- nodes:
- // Adjust for Svelte v5
- trimChildren(getChildren(consequent)),
- },
- ifBlock,
- ctx,
- ),
- );
+ for (const child of convertChildren(
+ {
+ nodes:
+ // Adjust for Svelte v5
+ trimChildren(getChildren(consequent)),
+ },
+ ifBlock,
+ ctx,
+ )) {
+ ifBlock.children.push(child);
+ }
ctx.scriptLet.closeScope();
if (elseif) {
@@ -218,17 +218,17 @@ export function convertIfBlock(
ifBlock.else = elseBlock;
ctx.scriptLet.nestBlock(elseBlock);
- elseBlock.children.push(
- ...convertChildren(
- {
- nodes:
- // Adjust for Svelte v5
- trimChildren(elseChildren),
- },
- elseBlock,
- ctx,
- ),
- );
+ for (const child of convertChildren(
+ {
+ nodes:
+ // Adjust for Svelte v5
+ trimChildren(elseChildren),
+ },
+ elseBlock,
+ ctx,
+ )) {
+ elseBlock.children.push(child);
+ }
ctx.scriptLet.closeScope();
extractMustacheBlockTokens(elseBlock, ctx, { startOnly: true });
diff --git a/src/parser/converts/root.ts b/src/parser/converts/root.ts
index 5e5e8de3..81614868 100644
--- a/src/parser/converts/root.ts
+++ b/src/parser/converts/root.ts
@@ -27,6 +27,7 @@ import {
getOptionsFromRoot,
} from "../compat.js";
import { sortNodes } from "../sort.js";
+import { withoutProjectParserOptions } from "../parser-options.js";
/**
* Convert root
@@ -259,11 +260,7 @@ function convertGenericsAttribute(script: SvelteScriptElement, ctx: Context) {
result = parseScriptWithoutAnalyzeScope(
scriptLet,
ctx.sourceCode.scripts.attrs,
- {
- ...ctx.parserOptions,
- // Without typings
- project: null,
- },
+ withoutProjectParserOptions(ctx.parserOptions),
) as unknown as TSESParseForESLintResult;
} catch {
// ignore
diff --git a/src/parser/index.ts b/src/parser/index.ts
index 641468cf..601e2914 100644
--- a/src/parser/index.ts
+++ b/src/parser/index.ts
@@ -170,9 +170,9 @@ function parseAsSvelte(
sortNodes(ctx.comments);
sortNodes(ctx.tokens);
extractTokens(ctx);
- analyzeStoreScope(resultScript.scopeManager!);
+ analyzeStoreScope(resultScript.scopeManager!, svelteParseContext);
analyzeReactiveScope(resultScript.scopeManager!);
- analyzeStoreScope(resultScript.scopeManager!); // for reactive vars
+ analyzeStoreScope(resultScript.scopeManager!, svelteParseContext); // for reactive vars
analyzeSnippetsScope(ctx.snippets, resultScript.scopeManager!);
// Add $$xxx variable
diff --git a/src/parser/parser-options.ts b/src/parser/parser-options.ts
index fd338485..44d43af1 100644
--- a/src/parser/parser-options.ts
+++ b/src/parser/parser-options.ts
@@ -9,6 +9,8 @@ import { getParserForLang, type UserOptionParser } from "./resolve-parser.js";
export type NormalizedParserOptions = {
parser?: UserOptionParser;
project?: string | string[] | null;
+ projectService?: unknown;
+ EXPERIMENTAL_useProjectService?: unknown;
ecmaVersion: number | "latest";
sourceType: "module" | "script";
@@ -104,3 +106,24 @@ export function isTypeScript(
return false;
}
+
+/**
+ * Remove typing-related options from parser options.
+ *
+ * Allows the typescript-eslint parser to parse a file without
+ * trying to collect typing information from TypeScript.
+ *
+ * See https://typescript-eslint.io/packages/parser#withoutprojectparseroptionsparseroptions
+ */
+export function withoutProjectParserOptions(
+ options: NormalizedParserOptions,
+): NormalizedParserOptions {
+ const {
+ project: _strippedProject,
+ projectService: _strippedProjectService,
+ EXPERIMENTAL_useProjectService: _strippedExperimentalUseProjectService,
+ ...result
+ } = options;
+
+ return result;
+}
diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts
index b6de0a9b..cea34041 100644
--- a/src/parser/typescript/analyze/index.ts
+++ b/src/parser/typescript/analyze/index.ts
@@ -23,6 +23,7 @@ import type { NormalizedParserOptions } from "../../parser-options.js";
import { setParent } from "../set-parent.js";
import { getGlobalsForSvelte, globalsForRunes } from "../../globals.js";
import type { SvelteParseContext } from "../../svelte-parse-context.js";
+import { withoutProjectParserOptions } from "../../parser-options.js";
export type AnalyzeTypeScriptContext = {
slots: Set;
@@ -53,11 +54,7 @@ export function analyzeTypeScriptInSvelte(
const result = parseScriptWithoutAnalyzeScope(
code.script + code.render + code.rootScope,
attrs,
- {
- ...parserOptions,
- // Without typings
- project: null,
- },
+ withoutProjectParserOptions(parserOptions),
) as unknown as TSESParseForESLintResult;
ctx._beforeResult = result;
@@ -73,15 +70,26 @@ export function analyzeTypeScriptInSvelte(
analyzeRuneVariables(result, ctx, context.svelteParseContext);
- applyTransforms(
- [
- ...analyzeReactiveScopes(result),
- ...analyzeDollarDerivedScopes(result, context.svelteParseContext),
- ],
- ctx,
- );
+ const scriptTransformers: TransformInfo[] = [
+ ...analyzeReactiveScopes(result),
+ ];
+ const templateTransformers: TransformInfo[] = [];
+ for (const transform of analyzeDollarDerivedScopes(
+ result,
+ context.svelteParseContext,
+ )) {
+ if (transform.node.range[0] < code.script.length) {
+ scriptTransformers.push(transform);
+ } else {
+ templateTransformers.push(transform);
+ }
+ }
- analyzeRenderScopes(code, ctx);
+ applyTransforms(scriptTransformers, ctx);
+
+ analyzeRenderScopes(code, ctx, () =>
+ applyTransforms(templateTransformers, ctx),
+ );
// When performing type checking on TypeScript code that is not a module, the error `Cannot redeclare block-scoped variable 'xxx'`. occurs. To fix this, add an `export`.
// see: https://github.com/sveltejs/svelte-eslint-parser/issues/557
@@ -107,11 +115,11 @@ export function analyzeTypeScript(
const ctx = new VirtualTypeScriptContext(code);
ctx.appendOriginal(/^\s*/u.exec(code)![0].length);
- const result = parseScriptWithoutAnalyzeScope(code, attrs, {
- ...parserOptions,
- // Without typings
- project: null,
- }) as unknown as TSESParseForESLintResult;
+ const result = parseScriptWithoutAnalyzeScope(
+ code,
+ attrs,
+ withoutProjectParserOptions(parserOptions),
+ ) as unknown as TSESParseForESLintResult;
ctx._beforeResult = result;
@@ -625,10 +633,12 @@ function* analyzeDollarDerivedScopes(
function analyzeRenderScopes(
code: { script: string; render: string; rootScope: string },
ctx: VirtualTypeScriptContext,
+ analyzeInTemplate: () => void,
) {
ctx.appendOriginal(code.script.length);
const renderFunctionName = ctx.generateUniqueId("render");
ctx.appendVirtualScript(`export function ${renderFunctionName}(){`);
+ analyzeInTemplate();
ctx.appendOriginal(code.script.length + code.render.length);
ctx.appendVirtualScript(`}`);
ctx.restoreContext.addRestoreStatementProcess((node, result) => {
diff --git a/tests/fixtures/integrations/snippet-scope/snippet-shadow-scope-setup.ts b/tests/fixtures/integrations/snippet-scope/snippet-shadow-scope-setup.ts
index 303b59e4..52336412 100644
--- a/tests/fixtures/integrations/snippet-scope/snippet-shadow-scope-setup.ts
+++ b/tests/fixtures/integrations/snippet-scope/snippet-shadow-scope-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils.js";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src/index.js";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts b/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts
index 9b7181f5..fa38171d 100644
--- a/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts
+++ b/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils.js";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src/index.js";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/$derived-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived-setup.ts
index 1751c29e..d412fd99 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts
index 1751c29e..d412fd99 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts
index 1751c29e..d412fd99 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts
index 1751c29e..d412fd99 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/$props-setup.ts b/tests/fixtures/integrations/type-info-tests/$props-setup.ts
index 1751c29e..d412fd99 100644
--- a/tests/fixtures/integrations/type-info-tests/$props-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$props-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/await-setup.ts b/tests/fixtures/integrations/type-info-tests/await-setup.ts
index 0776177e..6e873163 100644
--- a/tests/fixtures/integrations/type-info-tests/await-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/await-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts b/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts
index 1172dc96..5af1937a 100644
--- a/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/i18n-setup.ts b/tests/fixtures/integrations/type-info-tests/i18n-setup.ts
index 0776177e..6e873163 100644
--- a/tests/fixtures/integrations/type-info-tests/i18n-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/i18n-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/issue226-setup.ts b/tests/fixtures/integrations/type-info-tests/issue226-setup.ts
index 2b458b9d..0ad5e9ea 100644
--- a/tests/fixtures/integrations/type-info-tests/issue226-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/issue226-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts
index 14872ebb..05846f7d 100644
--- a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts b/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts
index 14872ebb..05846f7d 100644
--- a/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/reactive-setup.ts b/tests/fixtures/integrations/type-info-tests/reactive-setup.ts
index 12eb3010..b90f6180 100644
--- a/tests/fixtures/integrations/type-info-tests/reactive-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/reactive-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts b/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts
index 5804c700..96c7ba6f 100644
--- a/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts b/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts
index a1a075a0..348575af 100644
--- a/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts b/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts
index f8a6a783..50827a22 100644
--- a/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts
@@ -1,6 +1,6 @@
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "@typescript-eslint/eslint-plugin";
+import { plugin } from "typescript-eslint";
import * as parser from "../../../../src";
import globals from "globals";
@@ -8,7 +8,7 @@ export function getConfig(): Linter.Config {
return {
plugins: {
"@typescript-eslint": {
- rules: rules as any,
+ rules: plugin.rules as any,
},
},
languageOptions: {
diff --git a/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-input.svelte b/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-input.svelte
new file mode 100644
index 00000000..f2935614
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-input.svelte
@@ -0,0 +1,5 @@
+
+
+ $derived(0)} />
diff --git a/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-output.json b/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-output.json
new file mode 100644
index 00000000..af4df0a9
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-output.json
@@ -0,0 +1,1032 @@
+{
+ "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": "ImportDeclaration",
+ "importKind": "value",
+ "source": {
+ "type": "Literal",
+ "raw": "'./MyComponent.svelte'",
+ "value": "./MyComponent.svelte",
+ "range": [
+ 47,
+ 69
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 28
+ },
+ "end": {
+ "line": 2,
+ "column": 50
+ }
+ }
+ },
+ "specifiers": [
+ {
+ "type": "ImportDefaultSpecifier",
+ "local": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ ],
+ "range": [
+ 23,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 51
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 71,
+ 80
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ }
+ },
+ "range": [
+ 0,
+ 80
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "SvelteText",
+ "value": "\n\n",
+ "range": [
+ 80,
+ 82
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "SvelteElement",
+ "kind": "component",
+ "name": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 83,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [
+ {
+ "type": "SvelteAttribute",
+ "key": {
+ "type": "SvelteName",
+ "name": ":foo",
+ "range": [
+ 95,
+ 99
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 17
+ }
+ }
+ },
+ "boolean": false,
+ "value": [
+ {
+ "type": "SvelteMustacheTag",
+ "kind": "text",
+ "expression": {
+ "type": "ArrowFunctionExpression",
+ "async": false,
+ "body": {
+ "type": "CallExpression",
+ "arguments": [
+ {
+ "type": "Literal",
+ "raw": "0",
+ "value": 0,
+ "range": [
+ 116,
+ 117
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 34
+ },
+ "end": {
+ "line": 5,
+ "column": 35
+ }
+ }
+ }
+ ],
+ "callee": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 107,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 107,
+ 118
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 36
+ }
+ }
+ },
+ "expression": true,
+ "generator": false,
+ "id": null,
+ "params": [],
+ "range": [
+ 101,
+ 118
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 19
+ },
+ "end": {
+ "line": 5,
+ "column": 36
+ }
+ }
+ },
+ "range": [
+ 100,
+ 119
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 18
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ }
+ }
+ ],
+ "range": [
+ 95,
+ 119
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ }
+ }
+ ],
+ "selfClosing": true,
+ "range": [
+ 82,
+ 122
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 40
+ }
+ }
+ },
+ "children": [],
+ "endTag": null,
+ "range": [
+ 82,
+ 122
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 40
+ }
+ }
+ }
+ ],
+ "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": "import",
+ "range": [
+ 23,
+ 29
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "MyComponent",
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "from",
+ "range": [
+ 42,
+ 46
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 23
+ },
+ "end": {
+ "line": 2,
+ "column": 27
+ }
+ }
+ },
+ {
+ "type": "String",
+ "value": "'./MyComponent.svelte'",
+ "range": [
+ 47,
+ 69
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 28
+ },
+ "end": {
+ "line": 2,
+ "column": 50
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "range": [
+ 69,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 50
+ },
+ "end": {
+ "line": 2,
+ "column": 51
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 71,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 72,
+ 73
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 2
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 73,
+ 79
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 2
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 79,
+ 80
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "HTMLText",
+ "value": "\n\n",
+ "range": [
+ 80,
+ 82
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 82,
+ 83
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "MyComponent",
+ "range": [
+ 83,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": ":foo",
+ "range": [
+ 95,
+ 99
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 17
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "range": [
+ 99,
+ 100
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 17
+ },
+ "end": {
+ "line": 5,
+ "column": 18
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "range": [
+ 100,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 18
+ },
+ "end": {
+ "line": 5,
+ "column": 19
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 101,
+ 102
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 19
+ },
+ "end": {
+ "line": 5,
+ "column": 20
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 102,
+ 103
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 20
+ },
+ "end": {
+ "line": 5,
+ "column": 21
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=>",
+ "range": [
+ 104,
+ 106
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 22
+ },
+ "end": {
+ "line": 5,
+ "column": 24
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "$derived",
+ "range": [
+ 107,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 115,
+ 116
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 33
+ },
+ "end": {
+ "line": 5,
+ "column": 34
+ }
+ }
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "range": [
+ 116,
+ 117
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 34
+ },
+ "end": {
+ "line": 5,
+ "column": 35
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 117,
+ 118
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 35
+ },
+ "end": {
+ "line": 5,
+ "column": 36
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "range": [
+ 118,
+ 119
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 36
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 120,
+ 121
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 38
+ },
+ "end": {
+ "line": 5,
+ "column": 39
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 121,
+ 122
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 39
+ },
+ "end": {
+ "line": 5,
+ "column": 40
+ }
+ }
+ }
+ ],
+ "range": [
+ 0,
+ 123
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-scope-output.json b/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-scope-output.json
new file mode 100644
index 00000000..45ae4174
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$derived-in-template-with-ts01-scope-output.json
@@ -0,0 +1,345 @@
+{
+ "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": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 107,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ },
+ {
+ "name": "$effect",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$props",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$bindable",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$inspect",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$host",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ }
+ ],
+ "references": [],
+ "childScopes": [
+ {
+ "type": "module",
+ "variables": [
+ {
+ "name": "MyComponent",
+ "identifiers": [
+ {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ ],
+ "defs": [
+ {
+ "type": "ImportBinding",
+ "name": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ "node": {
+ "type": "ImportDefaultSpecifier",
+ "local": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 83,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 83,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 30,
+ 41
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ }
+ ],
+ "childScopes": [
+ {
+ "type": "function",
+ "variables": [],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 107,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ],
+ "childScopes": [],
+ "through": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 107,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ }
+ ],
+ "through": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 107,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ }
+ ],
+ "through": []
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-input.svelte b/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-input.svelte
new file mode 100644
index 00000000..7e006dff
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-input.svelte
@@ -0,0 +1,5 @@
+
+
+ $derived(0)} />
diff --git a/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-output.json b/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-output.json
new file mode 100644
index 00000000..ddf94b02
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-output.json
@@ -0,0 +1,884 @@
+{
+ "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": "'./MyComponent.svelte'",
+ "value": "./MyComponent.svelte",
+ "range": [
+ 37,
+ 59
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 28
+ },
+ "end": {
+ "line": 2,
+ "column": 50
+ }
+ }
+ },
+ "specifiers": [
+ {
+ "type": "ImportDefaultSpecifier",
+ "local": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ ],
+ "range": [
+ 13,
+ 60
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 51
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 61,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ }
+ },
+ "range": [
+ 0,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "SvelteText",
+ "value": "\n\n",
+ "range": [
+ 70,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "SvelteElement",
+ "kind": "component",
+ "name": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 73,
+ 84
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [
+ {
+ "type": "SvelteAttribute",
+ "key": {
+ "type": "SvelteName",
+ "name": ":foo",
+ "range": [
+ 85,
+ 89
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 17
+ }
+ }
+ },
+ "boolean": false,
+ "value": [
+ {
+ "type": "SvelteMustacheTag",
+ "kind": "text",
+ "expression": {
+ "type": "ArrowFunctionExpression",
+ "async": false,
+ "body": {
+ "type": "CallExpression",
+ "arguments": [
+ {
+ "type": "Literal",
+ "raw": "0",
+ "value": 0,
+ "range": [
+ 106,
+ 107
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 34
+ },
+ "end": {
+ "line": 5,
+ "column": 35
+ }
+ }
+ }
+ ],
+ "callee": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 97,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 97,
+ 108
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 36
+ }
+ }
+ },
+ "expression": true,
+ "generator": false,
+ "id": null,
+ "params": [],
+ "range": [
+ 91,
+ 108
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 19
+ },
+ "end": {
+ "line": 5,
+ "column": 36
+ }
+ }
+ },
+ "range": [
+ 90,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 18
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ }
+ }
+ ],
+ "range": [
+ 85,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ }
+ }
+ ],
+ "selfClosing": true,
+ "range": [
+ 72,
+ 112
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 40
+ }
+ }
+ },
+ "children": [],
+ "endTag": null,
+ "range": [
+ 72,
+ 112
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 40
+ }
+ }
+ }
+ ],
+ "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": [
+ 13,
+ 19
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "MyComponent",
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "from",
+ "range": [
+ 32,
+ 36
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 23
+ },
+ "end": {
+ "line": 2,
+ "column": 27
+ }
+ }
+ },
+ {
+ "type": "String",
+ "value": "'./MyComponent.svelte'",
+ "range": [
+ 37,
+ 59
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 28
+ },
+ "end": {
+ "line": 2,
+ "column": 50
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "range": [
+ 59,
+ 60
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 50
+ },
+ "end": {
+ "line": 2,
+ "column": 51
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 61,
+ 62
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 62,
+ 63
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 2
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 63,
+ 69
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 2
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 69,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "HTMLText",
+ "value": "\n\n",
+ "range": [
+ 70,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 72,
+ 73
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "MyComponent",
+ "range": [
+ 73,
+ 84
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": ":foo",
+ "range": [
+ 85,
+ 89
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 17
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "range": [
+ 89,
+ 90
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 17
+ },
+ "end": {
+ "line": 5,
+ "column": 18
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "range": [
+ 90,
+ 91
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 18
+ },
+ "end": {
+ "line": 5,
+ "column": 19
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 91,
+ 92
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 19
+ },
+ "end": {
+ "line": 5,
+ "column": 20
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 92,
+ 93
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 20
+ },
+ "end": {
+ "line": 5,
+ "column": 21
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=>",
+ "range": [
+ 94,
+ 96
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 22
+ },
+ "end": {
+ "line": 5,
+ "column": 24
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "$derived",
+ "range": [
+ 97,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 105,
+ 106
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 33
+ },
+ "end": {
+ "line": 5,
+ "column": 34
+ }
+ }
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "range": [
+ 106,
+ 107
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 34
+ },
+ "end": {
+ "line": 5,
+ "column": 35
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 107,
+ 108
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 35
+ },
+ "end": {
+ "line": 5,
+ "column": 36
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "range": [
+ 108,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 36
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 110,
+ 111
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 38
+ },
+ "end": {
+ "line": 5,
+ "column": 39
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 111,
+ 112
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 39
+ },
+ "end": {
+ "line": 5,
+ "column": 40
+ }
+ }
+ }
+ ],
+ "range": [
+ 0,
+ 113
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-scope-output.json b/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-scope-output.json
new file mode 100644
index 00000000..0e14a8ee
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$derived-in-template-without-ts01-scope-output.json
@@ -0,0 +1,345 @@
+{
+ "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": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 97,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ },
+ {
+ "name": "$effect",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$props",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$bindable",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$inspect",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$host",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ }
+ ],
+ "references": [],
+ "childScopes": [
+ {
+ "type": "module",
+ "variables": [
+ {
+ "name": "MyComponent",
+ "identifiers": [
+ {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ ],
+ "defs": [
+ {
+ "type": "ImportBinding",
+ "name": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ "node": {
+ "type": "ImportDefaultSpecifier",
+ "local": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ },
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 73,
+ 84
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 73,
+ 84
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "MyComponent",
+ "range": [
+ 20,
+ 31
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ }
+ }
+ }
+ ],
+ "childScopes": [
+ {
+ "type": "function",
+ "variables": [],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 97,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ],
+ "childScopes": [],
+ "through": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 97,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ }
+ ],
+ "through": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$derived",
+ "range": [
+ 97,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 25
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ }
+ },
+ "from": "function",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ }
+ ],
+ "through": []
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-config.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-config.json
new file mode 100644
index 00000000..623877c3
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-config.json
@@ -0,0 +1,7 @@
+{
+ "svelteConfig": {
+ "compilerOptions": {
+ "runes": true
+ }
+ }
+}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-input.svelte b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-input.svelte
new file mode 100644
index 00000000..ee5502fb
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-input.svelte
@@ -0,0 +1,6 @@
+
+
+{props}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-output.json
new file mode 100644
index 00000000..7d51d648
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-output.json
@@ -0,0 +1,785 @@
+{
+ "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": "const",
+ "declarations": [
+ {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 68,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 60,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ ],
+ "range": [
+ 54,
+ 77
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 78,
+ 87
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ "range": [
+ 0,
+ 87
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "SvelteText",
+ "value": "\n\n",
+ "range": [
+ 87,
+ 89
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "SvelteElement",
+ "kind": "html",
+ "name": {
+ "type": "SvelteName",
+ "name": "span",
+ "range": [
+ 90,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [],
+ "selfClosing": false,
+ "range": [
+ 89,
+ 95
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ "children": [
+ {
+ "type": "SvelteMustacheTag",
+ "kind": "text",
+ "expression": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "range": [
+ 95,
+ 102
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 102,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ },
+ "range": [
+ 89,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "sourceType": "module",
+ "comments": [
+ {
+ "type": "Line",
+ "value": " It should not be recognized as a store.",
+ "range": [
+ 10,
+ 52
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 1
+ },
+ "end": {
+ "line": 2,
+ "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": "const",
+ "range": [
+ 54,
+ 59
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "range": [
+ 66,
+ 67
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 74,
+ 75
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 21
+ },
+ "end": {
+ "line": 3,
+ "column": 22
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 75,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 22
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "range": [
+ 76,
+ 77
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 23
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 78,
+ 79
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 79,
+ 80
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 1
+ },
+ "end": {
+ "line": 4,
+ "column": 2
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 80,
+ 86
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 2
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 86,
+ 87
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "HTMLText",
+ "value": "\n\n",
+ "range": [
+ 87,
+ 89
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 89,
+ 90
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 90,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 94,
+ 95
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "range": [
+ 95,
+ 96
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "range": [
+ 101,
+ 102
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 12
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 102,
+ 103
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 103,
+ 104
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 15
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 104,
+ 108
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 15
+ },
+ "end": {
+ "line": 6,
+ "column": 19
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 108,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 19
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "range": [
+ 0,
+ 110
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-scope-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-scope-output.json
new file mode 100644
index 00000000..0c95113b
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-scope-output.json
@@ -0,0 +1,429 @@
+{
+ "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": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ },
+ {
+ "name": "$bindable",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$inspect",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$host",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ }
+ ],
+ "references": [],
+ "childScopes": [
+ {
+ "type": "module",
+ "variables": [
+ {
+ "name": "props",
+ "identifiers": [
+ {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ ],
+ "defs": [
+ {
+ "type": "Variable",
+ "name": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "node": {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 68,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 60,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": null
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ],
+ "childScopes": [],
+ "through": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ }
+ ],
+ "through": []
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-config.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-config.json
new file mode 100644
index 00000000..f5145143
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-config.json
@@ -0,0 +1,7 @@
+{
+ "svelteConfig": {
+ "compilerOptions": {
+ "runes": false
+ }
+ }
+}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-input.svelte b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-input.svelte
new file mode 100644
index 00000000..0ef437b2
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-input.svelte
@@ -0,0 +1,6 @@
+
+
+{props}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-output.json
new file mode 100644
index 00000000..ef78b834
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-output.json
@@ -0,0 +1,785 @@
+{
+ "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": "const",
+ "declarations": [
+ {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 64,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 56,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ ],
+ "range": [
+ 50,
+ 73
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 74,
+ 83
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ "range": [
+ 0,
+ 83
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "SvelteText",
+ "value": "\n\n",
+ "range": [
+ 83,
+ 85
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "SvelteElement",
+ "kind": "html",
+ "name": {
+ "type": "SvelteName",
+ "name": "span",
+ "range": [
+ 86,
+ 90
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [],
+ "selfClosing": false,
+ "range": [
+ 85,
+ 91
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ "children": [
+ {
+ "type": "SvelteMustacheTag",
+ "kind": "text",
+ "expression": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "range": [
+ 91,
+ 98
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 98,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ },
+ "range": [
+ 85,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "sourceType": "module",
+ "comments": [
+ {
+ "type": "Line",
+ "value": " It should be recognized as a store.",
+ "range": [
+ 10,
+ 48
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 1
+ },
+ "end": {
+ "line": 2,
+ "column": 39
+ }
+ }
+ }
+ ],
+ "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": "const",
+ "range": [
+ 50,
+ 55
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "range": [
+ 62,
+ 63
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 70,
+ 71
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 21
+ },
+ "end": {
+ "line": 3,
+ "column": 22
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 71,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 22
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "range": [
+ 72,
+ 73
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 23
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 74,
+ 75
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 75,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 1
+ },
+ "end": {
+ "line": 4,
+ "column": 2
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 76,
+ 82
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 2
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 82,
+ 83
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "HTMLText",
+ "value": "\n\n",
+ "range": [
+ 83,
+ 85
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 85,
+ 86
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 86,
+ 90
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 90,
+ 91
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "range": [
+ 91,
+ 92
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "range": [
+ 97,
+ 98
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 12
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 98,
+ 99
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 99,
+ 100
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 15
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 100,
+ 104
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 15
+ },
+ "end": {
+ "line": 6,
+ "column": 19
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 104,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 19
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "range": [
+ 0,
+ 106
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-scope-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-scope-output.json
new file mode 100644
index 00000000..dffec93b
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-scope-output.json
@@ -0,0 +1,396 @@
+{
+ "type": "global",
+ "variables": [
+ {
+ "name": "$$slots",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$$props",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$$restProps",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ }
+ ],
+ "references": [],
+ "childScopes": [
+ {
+ "type": "module",
+ "variables": [
+ {
+ "name": "props",
+ "identifiers": [
+ {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ ],
+ "defs": [
+ {
+ "type": "Variable",
+ "name": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "node": {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 64,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 56,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ],
+ "childScopes": [],
+ "through": []
+ }
+ ],
+ "through": []
+}
\ No newline at end of file