diff --git a/.changeset/grumpy-pans-guess.md b/.changeset/grumpy-pans-guess.md new file mode 100644 index 00000000..3c4129ef --- /dev/null +++ b/.changeset/grumpy-pans-guess.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: add support for `{#snippet}` and `{@render}` diff --git a/docs/AST.md b/docs/AST.md index 9437463c..6173589c 100644 --- a/docs/AST.md +++ b/docs/AST.md @@ -104,10 +104,12 @@ type Child = | SvelteMustacheTag | SvelteDebugTag | SvelteConstTag + | SvelteRenderTag | SvelteIfBlock | SvelteEachBlock | SvelteAwaitBlock | SvelteKeyBlock + | SvelteSnippetBlock | SvelteHTMLComment; ``` @@ -421,6 +423,18 @@ interface SvelteConstTag extends Node { } ``` +### SvelteRenderTag + +This is the `{@render}` tag node. + +```ts +interface SvelteRenderTag extends Node { + type: "SvelteRenderTag"; + callee: Identifier; + argument: Expression | null; +} +``` + [VariableDeclarator] is a node defined in ESTree. ### SvelteIfBlock @@ -533,6 +547,19 @@ interface SvelteKeyBlock extends Node { } ``` +### SvelteSnippetBlock + +This is the `{#snippet}` tag node. + +```ts +interface SvelteSnippetBlock extends Node { + type: "SvelteSnippetBlock"; + id: Identifier; + context: null | Pattern; + children: Child[]; +} +``` + ## Comments ### SvelteHTMLComment diff --git a/explorer-v2/package.json b/explorer-v2/package.json index 073f3691..960d7f59 100644 --- a/explorer-v2/package.json +++ b/explorer-v2/package.json @@ -12,26 +12,26 @@ "preview": "vite preview" }, "dependencies": { - "@fontsource/fira-mono": "^5.0.0", - "@typescript-eslint/parser": "^6.0.0", - "eslint": "^8.0.0", - "eslint-scope": "^7.0.0", + "@fontsource/fira-mono": "^5.0.8", + "@typescript-eslint/parser": "^6.11.0", + "eslint": "^8.54.0", + "eslint-scope": "^7.2.2", "esquery": "^1.5.0", - "pako": "^2.0.3", - "svelte": "^5.0.0-next.2", + "pako": "^2.1.0", + "svelte": "^5.0.0-next.8", "svelte-eslint-parser": "link:..", - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "devDependencies": { - "@sveltejs/adapter-static": "^2.0.0", - "@sveltejs/kit": "^1.0.0-next.456", - "prettier": "^3.0.0", - "prettier-plugin-svelte": "^3.0.0", - "string-replace-loader": "^3.0.1", - "typescript": "^5.0.4", + "@sveltejs/adapter-static": "^2.0.3", + "@sveltejs/kit": "^1.27.6", + "prettier": "^3.1.0", + "prettier-plugin-svelte": "^3.1.0", + "string-replace-loader": "^3.1.0", + "typescript": "^5.2.2", "vite": "^5.0.0", - "webpack": "^5.82.1", - "webpack-cli": "^5.0.0", - "wrapper-webpack-plugin": "^2.1.0" + "webpack": "^5.89.0", + "webpack-cli": "^5.1.4", + "wrapper-webpack-plugin": "^2.2.2" } } diff --git a/explorer-v2/src/app.html b/explorer-v2/src/app.html index 0c2d11b8..e4cd7565 100644 --- a/explorer-v2/src/app.html +++ b/explorer-v2/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/explorer-v2/src/lib/MonacoEditor.svelte b/explorer-v2/src/lib/MonacoEditor.svelte index b4d6d374..11a1121a 100644 --- a/explorer-v2/src/lib/MonacoEditor.svelte +++ b/explorer-v2/src/lib/MonacoEditor.svelte @@ -94,6 +94,7 @@ renderValidationDecorations: 'on', renderWhitespace: 'boundary', scrollBeyondLastLine: false, + useInlineViewWhenSpaceIsLimited: false, ...editorOptions }; diff --git a/package.json b/package.json index 92a238ca..c5f36012 100644 --- a/package.json +++ b/package.json @@ -70,11 +70,11 @@ "@types/eslint": "^8.40.1", "@types/eslint-scope": "^3.7.4", "@types/eslint-visitor-keys": "^1.0.0", - "@types/estree": "^1.0.1", + "@types/estree": "^1.0.5", "@types/mocha": "^10.0.1", "@types/node": "^20.0.0", "@types/semver": "^7.5.0", - "@typescript-eslint/eslint-plugin": "^6.9.0", + "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "~6.10.0", "@typescript-eslint/types": "~6.10.0", "benchmark": "^2.1.4", diff --git a/src/ast/html.ts b/src/ast/html.ts index 106a1e83..081674bb 100644 --- a/src/ast/html.ts +++ b/src/ast/html.ts @@ -16,6 +16,7 @@ export type SvelteHTMLNode = | SvelteMustacheTag | SvelteDebugTag | SvelteConstTag + | SvelteRenderTag | SvelteIfBlock | SvelteElseBlock | SvelteEachBlock @@ -24,6 +25,7 @@ export type SvelteHTMLNode = | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock + | SvelteSnippetBlock | SvelteAttribute | SvelteShorthandAttribute | SvelteSpreadAttribute @@ -87,7 +89,8 @@ export interface SvelteHTMLElement extends BaseSvelteElement { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of Svelte component element. */ export interface SvelteComponentElement extends BaseSvelteElement { @@ -106,7 +109,8 @@ export interface SvelteComponentElement extends BaseSvelteElement { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of Svelte special component element. e.g. `` */ export interface SvelteSpecialElement extends BaseSvelteElement { @@ -125,7 +129,8 @@ export interface SvelteSpecialElement extends BaseSvelteElement { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of start tag. */ export interface SvelteStartTag extends BaseNode { @@ -174,10 +179,12 @@ type Child = | SvelteMustacheTag | SvelteDebugTag | SvelteConstTag + | SvelteRenderTag | SvelteIfBlockAlone | SvelteEachBlock | SvelteAwaitBlock | SvelteKeyBlock + | SvelteSnippetBlock | SvelteHTMLComment; /** Node of text. like HTML text. */ @@ -194,7 +201,8 @@ export interface SvelteText extends BaseNode { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of literal. */ export interface SvelteLiteral extends BaseNode { @@ -219,6 +227,7 @@ interface BaseSvelteMustacheTag extends BaseNode { | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock + | SvelteSnippetBlock | SvelteAttribute | SvelteStyleDirective; } @@ -244,6 +253,7 @@ export interface SvelteDebugTag extends BaseNode { | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock + | SvelteSnippetBlock | SvelteAttribute; } /** Node of const tag. e.g. `{@const}` */ @@ -260,8 +270,26 @@ export interface SvelteConstTag extends BaseNode { | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock + | SvelteSnippetBlock | SvelteAttribute; } +/** Node of render tag. e.g. `{@render}` */ +export interface SvelteRenderTag extends BaseNode { + type: "SvelteRenderTag"; + callee: ESTree.Identifier; + argument: ESTree.Expression | null; + parent: + | SvelteProgram + | SvelteElement + | SvelteIfBlock + | SvelteElseBlockAlone + | SvelteEachBlock + | SvelteAwaitPendingBlock + | SvelteAwaitThenBlock + | SvelteAwaitCatchBlock + | SvelteKeyBlock + | SvelteSnippetBlock; +} /** Node of if block. e.g. `{#if}` */ export type SvelteIfBlock = SvelteIfBlockAlone | SvelteIfBlockElseIf; interface BaseSvelteIfBlock extends BaseNode { @@ -279,7 +307,8 @@ interface BaseSvelteIfBlock extends BaseNode { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of if block. e.g. `{#if}` */ export interface SvelteIfBlockAlone extends BaseSvelteIfBlock { @@ -328,7 +357,8 @@ export interface SvelteEachBlock extends BaseNode { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of await block. e.g. `{#await}`, `{#await ... then ... }`, `{#await ... catch ... }` */ export type SvelteAwaitBlock = @@ -351,7 +381,8 @@ interface BaseSvelteAwaitBlock extends BaseNode { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of await block. e.g. `{#await}` */ export interface SvelteAwaitBlockAwaitPending extends BaseSvelteAwaitBlock { @@ -442,7 +473,26 @@ export interface SvelteKeyBlock extends BaseNode { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; +} +/** Node of snippet block. e.g. `{#snippet}` */ +export interface SvelteSnippetBlock extends BaseNode { + type: "SvelteSnippetBlock"; + id: ESTree.Identifier; + context: null | ESTree.Pattern; + children: Child[]; + parent: + | SvelteProgram + | SvelteElement + | SvelteIfBlock + | SvelteElseBlockAlone + | SvelteEachBlock + | SvelteAwaitPendingBlock + | SvelteAwaitThenBlock + | SvelteAwaitCatchBlock + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of HTML comment. */ export interface SvelteHTMLComment extends BaseNode { @@ -457,7 +507,8 @@ export interface SvelteHTMLComment extends BaseNode { | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock; + | SvelteKeyBlock + | SvelteSnippetBlock; } /** Node of HTML attribute. */ export interface SvelteAttribute extends BaseNode { diff --git a/src/context/index.ts b/src/context/index.ts index 4b061b5e..d172d211 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -6,6 +6,7 @@ import type { SvelteHTMLElement, SvelteName, SvelteScriptElement, + SvelteSnippetBlock, SvelteStyleElement, Token, } from "../ast"; @@ -142,6 +143,8 @@ export class Context { | SvAST.Title >(); + public readonly snippets: SvelteSnippetBlock[] = []; + // ----- States ------ private readonly state: { isTypeScript?: boolean } = {}; diff --git a/src/context/script-let.ts b/src/context/script-let.ts index 6953b75a..7d594dc5 100644 --- a/src/context/script-let.ts +++ b/src/context/script-let.ts @@ -10,6 +10,7 @@ import type { SvelteIfBlock, SvelteName, SvelteNode, + SvelteSnippetBlock, Token, } from "../ast"; import type { ESLintExtendedProgram } from "../parser"; @@ -148,6 +149,15 @@ export class ScriptLetContext { ...callbacks: ScriptLetCallback[] ): ScriptLetCallback[] { const range = getNodeRange(expression); + return this.addExpressionFromRange(range, parent, typing, ...callbacks); + } + + public addExpressionFromRange( + range: [number, number], + parent: SvelteNode, + typing?: string | null, + ...callbacks: ScriptLetCallback[] + ): ScriptLetCallback[] { const part = this.ctx.code.slice(...range); const isTS = typing && this.ctx.isTypeScript(); this.appendScript( @@ -414,6 +424,45 @@ export class ScriptLetContext { this.pushScope(restore, "});"); } + public nestSnippetBlock( + id: ESTree.Identifier, + closeParentIndex: number, + snippetBlock: SvelteSnippetBlock, + callback: (id: ESTree.Identifier, ctx: ESTree.Pattern | null) => void, + ): void { + const idRange = getNodeRange(id); + const part = this.ctx.code.slice(idRange[0], closeParentIndex + 1); + const restore = this.appendScript( + `function ${part}{`, + idRange[0] - 9, + (st, tokens, _comments, result) => { + const fnDecl = st as ESTree.FunctionDeclaration; + const idNode = fnDecl.id; + const context = fnDecl.params.length > 0 ? fnDecl.params[0] : null; + const scope = result.getScope(fnDecl); + + // Process for nodes + callback(idNode, context); + (idNode as any).parent = snippetBlock; + if (context) { + (context as any).parent = snippetBlock; + } + + // Process for scope + result.registerNodeToScope(snippetBlock, scope); + + tokens.shift(); // function + tokens.pop(); // { + tokens.pop(); // } + + // Disconnect the tree structure. + fnDecl.id = null as never; + fnDecl.params = []; + }, + ); + this.pushScope(restore, "}"); + } + public nestBlock( block: SvelteNode, params?: diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts index b6f35935..01650c2f 100644 --- a/src/parser/analyze-scope.ts +++ b/src/parser/analyze-scope.ts @@ -2,8 +2,12 @@ import type ESTree from "estree"; import type { Scope, ScopeManager } from "eslint-scope"; import { Variable, Reference, analyze } from "eslint-scope"; import { getFallbackKeys } from "../traverse"; -import type { SvelteReactiveStatement, SvelteScriptElement } from "../ast"; -import { addReference, addVariable } from "../scope"; +import type { + SvelteReactiveStatement, + SvelteScriptElement, + SvelteSnippetBlock, +} from "../ast"; +import { addReference, addVariable, getScopeFromNode } from "../scope"; import { addElementToSortedArray } from "../utils"; import type { NormalizedParserOptions } from "./parser-options"; /** @@ -218,6 +222,33 @@ export function analyzePropsScope( } } +/** Analyze snippets in component scope */ +export function analyzeSnippetsScope( + snippets: SvelteSnippetBlock[], + scopeManager: ScopeManager, +): void { + for (const snippet of snippets) { + const parent = snippet.parent; + if ( + parent.type === "SvelteElement" && + (parent.kind === "component" || + (parent.kind === "special" && parent.name.name === "svelte:component")) + ) { + const scope = getScopeFromNode(scopeManager, snippet.id); + const variable = scope.upper + ? scope.upper.set.get(snippet.id.name) + : null; + if (variable) { + // Add the virtual reference for reading. + const reference = addVirtualReference(snippet.id, variable, scope, { + read: true, + }); + (reference as any).svelteSnippetReference = true; + } + } + } +} + /** Remove reference from through */ function removeReferenceFromThrough(reference: Reference, baseScope: Scope) { const variable = reference.resolved!; diff --git a/src/parser/converts/block.ts b/src/parser/converts/block.ts index 41c3ec4f..f8beb955 100644 --- a/src/parser/converts/block.ts +++ b/src/parser/converts/block.ts @@ -14,6 +14,7 @@ import type { SvelteIfBlockAlone, SvelteIfBlockElseIf, SvelteKeyBlock, + SvelteSnippetBlock, } from "../../ast"; import type { Context } from "../../context"; import { convertChildren } from "./element"; @@ -433,6 +434,46 @@ export function convertKeyBlock( return keyBlock; } +/** Convert for SnippetBlock */ +export function convertSnippetBlock( + node: SvAST.SnippetBlock, + parent: SvelteSnippetBlock["parent"], + ctx: Context, +): SvelteSnippetBlock { + // {#snippet x(args)}...{/snippet} + const snippetBlock: SvelteSnippetBlock = { + type: "SvelteSnippetBlock", + id: null as any, + context: null as any, + children: [], + parent, + ...ctx.getConvertLocation(node), + }; + + const closeParenIndex = ctx.code.indexOf( + ")", + getWithLoc(node.context || node.expression).end, + ); + + ctx.scriptLet.nestSnippetBlock( + node.expression, + closeParenIndex, + snippetBlock, + (id, context) => { + snippetBlock.id = id; + snippetBlock.context = context; + }, + ); + + snippetBlock.children.push(...convertChildren(node, snippetBlock, ctx)); + + ctx.scriptLet.closeScope(); + extractMustacheBlockTokens(snippetBlock, ctx); + + ctx.snippets.push(snippetBlock); + return snippetBlock; +} + /** Extract mustache block tokens */ function extractMustacheBlockTokens( node: @@ -442,7 +483,8 @@ function extractMustacheBlockTokens( | SvelteAwaitBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock, + | SvelteKeyBlock + | SvelteSnippetBlock, ctx: Context, option?: { startOnly?: true }, ) { diff --git a/src/parser/converts/element.ts b/src/parser/converts/element.ts index 2c44cbef..7255d8f7 100644 --- a/src/parser/converts/element.ts +++ b/src/parser/converts/element.ts @@ -19,7 +19,9 @@ import type { SvelteMustacheTag, SvelteName, SvelteProgram, + SvelteRenderTag, SvelteScriptElement, + SvelteSnippetBlock, SvelteSpecialDirective, SvelteSpecialElement, SvelteStyleElement, @@ -34,6 +36,7 @@ import { convertEachBlock, convertIfBlock, convertKeyBlock, + convertSnippetBlock, } from "./block"; import { getWithLoc, indexOf } from "./common"; import { @@ -47,6 +50,7 @@ import { convertConstTag } from "./const"; import { sortNodes } from "../sort"; import type { ScriptLetBlockParam } from "../../context/script-let"; import { ParseError } from "../.."; +import { convertRenderTag } from "./render"; /* eslint-disable complexity -- X */ /** Convert for Fragment or Element or ... */ @@ -62,7 +66,8 @@ export function* convertChildren( | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock - | SvelteKeyBlock, + | SvelteKeyBlock + | SvelteSnippetBlock, ctx: Context, ): IterableIterator< | SvelteText @@ -70,10 +75,12 @@ export function* convertChildren( | SvelteMustacheTag | SvelteDebugTag | SvelteConstTag + | SvelteRenderTag | SvelteIfBlockAlone | SvelteEachBlock | SvelteAwaitBlock | SvelteKeyBlock + | SvelteSnippetBlock | SvelteHTMLComment > { if (!fragment.children) return; @@ -137,6 +144,11 @@ export function* convertChildren( yield convertKeyBlock(child, parent, ctx); continue; } + if (child.type === "SnippetBlock") { + // {#snippet x(args)}...{/snippet} + yield convertSnippetBlock(child, parent, ctx); + continue; + } if (child.type === "Window") { yield convertWindowElement(child, parent, ctx); continue; @@ -169,6 +181,10 @@ export function* convertChildren( yield convertConstTag(child, parent, ctx); continue; } + if (child.type === "RenderTag") { + yield convertRenderTag(child, parent, ctx); + continue; + } if (child.type === "Document") { yield convertDocumentElement(child, parent, ctx); continue; @@ -207,6 +223,9 @@ function needScopeByChildren(fragment: { if (child.type === "ConstTag") { return true; } + if (child.type === "SnippetBlock") { + return true; + } } return false; } diff --git a/src/parser/converts/render.ts b/src/parser/converts/render.ts new file mode 100644 index 00000000..3e74e2fe --- /dev/null +++ b/src/parser/converts/render.ts @@ -0,0 +1,44 @@ +import type * as ESTree from "estree"; +import type { SvelteRenderTag } from "../../ast"; +import type { Context } from "../../context"; +import type * as SvAST from "../svelte-ast-types"; +import { getWithLoc } from "./common"; + +/** Convert for RenderTag */ +export function convertRenderTag( + node: SvAST.RenderTag, + parent: SvelteRenderTag["parent"], + ctx: Context, +): SvelteRenderTag { + const mustache: SvelteRenderTag = { + type: "SvelteRenderTag", + callee: null as any, + argument: null, + parent, + ...ctx.getConvertLocation(node), + }; + const calleeRange = getWithLoc(node.expression); + const closeParenIndex = ctx.code.indexOf( + ")", + node.argument ? getWithLoc(node.argument).end : calleeRange.end, + ); + ctx.scriptLet.addExpressionFromRange( + [calleeRange.start, closeParenIndex + 1], + mustache, + null, + (expression: ESTree.SimpleCallExpression) => { + mustache.callee = expression.callee as ESTree.Identifier; + (mustache.callee as any).parent = mustache; + if (expression.arguments.length) { + mustache.argument = expression.arguments[0] as ESTree.Expression; + (mustache.argument as any).parent = mustache; + } + }, + ); + const atRenderStart = ctx.code.indexOf("@render", mustache.range[0]); + ctx.addToken("MustacheKeyword", { + start: atRenderStart, + end: atRenderStart + 7, + }); + return mustache; +} diff --git a/src/parser/index.ts b/src/parser/index.ts index 8fc7df35..9b8e1980 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -17,6 +17,7 @@ import { parseTemplate } from "./template"; import { analyzePropsScope, analyzeReactiveScope, + analyzeSnippetsScope, analyzeStoreScope, } from "./analyze-scope"; import { ParseError } from "../errors"; @@ -86,7 +87,9 @@ export function parseForESLint(code: string, options?: any): ParseResult { if ( svelteVersion.hasRunes && parserOptions.filePath && - !parserOptions.filePath.endsWith(".svelte") + !parserOptions.filePath.endsWith(".svelte") && + // If no `filePath` is set in ESLint, "" will be specified. + parserOptions.filePath !== "" ) { const trimmed = code.trim(); if (!trimmed.startsWith("<") && !trimmed.endsWith(">")) { @@ -133,6 +136,7 @@ function parseAsSvelte( analyzeStoreScope(resultScript.scopeManager!); analyzeReactiveScope(resultScript.scopeManager!); analyzeStoreScope(resultScript.scopeManager!); // for reactive vars + analyzeSnippetsScope(ctx.snippets, resultScript.scopeManager!); // for reactive vars // Add $$xxx variable addGlobalVariables(resultScript.scopeManager!, globals); diff --git a/src/parser/svelte-ast-types.ts b/src/parser/svelte-ast-types.ts index 77bb0d79..4ebf1af2 100644 --- a/src/parser/svelte-ast-types.ts +++ b/src/parser/svelte-ast-types.ts @@ -15,6 +15,7 @@ export declare type TemplateNode = | RawMustacheTag | DebugTag | ConstTag + | RenderTag | Directive | StyleDirective | Element @@ -31,7 +32,8 @@ export declare type TemplateNode = | IfBlock | EachBlock | AwaitBlock - | KeyBlock; + | KeyBlock + | SnippetBlock; export interface Fragment extends BaseNode { type: "Fragment"; children: TemplateNode[]; @@ -56,6 +58,11 @@ export interface ConstTag extends BaseNode { type: "ConstTag"; expression: ESTree.AssignmentExpression; } +export interface RenderTag extends BaseNode { + type: "RenderTag"; + expression: ESTree.Identifier; + argument: null | ESTree.Expression; +} export interface IfBlock extends BaseNode { type: "IfBlock"; expression: ESTree.Expression; @@ -106,6 +113,12 @@ export interface KeyBlock extends BaseNode { expression: ESTree.Expression; children: TemplateNode[]; } +export interface SnippetBlock extends BaseNode { + type: "SnippetBlock"; + expression: ESTree.Identifier; + context: null | ESTree.Pattern; + children: TemplateNode[]; +} export interface BaseElement extends BaseNode { type: "Element"; diff --git a/src/visitor-keys.ts b/src/visitor-keys.ts index d9a02cef..c9b2caad 100644 --- a/src/visitor-keys.ts +++ b/src/visitor-keys.ts @@ -22,6 +22,7 @@ const svelteKeys: SvelteKeysType = { SvelteMustacheTag: ["expression"], SvelteDebugTag: ["identifiers"], SvelteConstTag: ["declaration"], + SvelteRenderTag: ["callee", "argument"], SvelteIfBlock: ["expression", "children", "else"], SvelteElseBlock: ["children"], SvelteEachBlock: [ @@ -37,6 +38,7 @@ const svelteKeys: SvelteKeysType = { SvelteAwaitThenBlock: ["value", "children"], SvelteAwaitCatchBlock: ["error", "children"], SvelteKeyBlock: ["expression", "children"], + SvelteSnippetBlock: ["id", "context", "children"], SvelteAttribute: ["key", "value"], SvelteShorthandAttribute: ["key", "value"], SvelteSpreadAttribute: ["argument"], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-input.svelte new file mode 100644 index 00000000..195e6a73 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-input.svelte @@ -0,0 +1,21 @@ +{#snippet figure(image)} +
+ {image.caption} +
{image.caption}
+
+{/snippet} + +{#each images as image} + {#if image.href} + + {@render figure(image)} + + {:else} + {@render figure(image)} + {/if} +{/each} diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-no-undef-result.json new file mode 100644 index 00000000..08afd868 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "images", + "line": 13, + "column": 8 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-output.json new file mode 100644 index 00000000..6cb9ad66 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-output.json @@ -0,0 +1,3442 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "figure", + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "img", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "src", + "range": [ + 45, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 50, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "src", + "range": [ + 56, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "range": [ + 50, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 18 + } + } + } + ], + "range": [ + 45, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "alt", + "range": [ + 64, + 67 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "caption", + "range": [ + 75, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 69, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 68, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "range": [ + 64, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "width", + "range": [ + 87, + 92 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 94, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "width", + "range": [ + 100, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 94, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 93, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 87, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "height", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 118, + 123 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "height", + "range": [ + 124, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "range": [ + 118, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + "range": [ + 117, + 131 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 24 + } + } + } + ], + "range": [ + 110, + 131 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 24 + } + } + } + ], + "selfClosing": true, + "range": [ + 37, + 136 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 37, + 136 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 136, + 139 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "figcaption", + "range": [ + 140, + 150 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 139, + 151 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 152, + 157 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "caption", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "range": [ + 152, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "range": [ + 151, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 29 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 166, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + "range": [ + 139, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 179, + 181 + ], + "loc": { + "start": { + "line": 9, + "column": 42 + }, + "end": { + "line": 10, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 181, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "range": [ + 26, + 190 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 10, + "column": 10 + } + } + } + ], + "context": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "id": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 201 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 201, + 203 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "images", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 233, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "href", + "range": [ + 239, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "range": [ + 233, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "a", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "href", + "range": [ + 250, + 254 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 256, + 261 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "href", + "range": [ + 262, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + "range": [ + 256, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + "range": [ + 255, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 22 + } + } + } + ], + "range": [ + 250, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 22 + } + } + } + ], + "selfClosing": false, + "range": [ + 247, + 268 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t\t", + "range": [ + 268, + 272 + ], + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": { + "type": "Identifier", + "name": "image", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + "callee": { + "type": "Identifier", + "name": "figure", + "range": [ + 281, + 287 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "range": [ + 272, + 295 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 295, + 298 + ], + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 17, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 298, + 302 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + "range": [ + 247, + 302 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 6 + } + } + } + ], + "else": { + "type": "SvelteElseBlock", + "elseif": false, + "children": [ + { + "type": "SvelteRenderTag", + "argument": { + "type": "Identifier", + "name": "image", + "range": [ + 330, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "callee": { + "type": "Identifier", + "name": "figure", + "range": [ + 323, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "range": [ + 314, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 25 + } + } + } + ], + "range": [ + 304, + 339 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + "range": [ + 228, + 344 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 20, + "column": 6 + } + } + } + ], + "else": null, + "range": [ + 203, + 352 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 21, + "column": 7 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figure", + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "img", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "src", + "range": [ + 45, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 50, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "src", + "range": [ + 56, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "alt", + "range": [ + 64, + 67 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "caption", + "range": [ + 75, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "width", + "range": [ + 87, + 92 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 94, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 100, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "height", + "range": [ + 110, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 118, + 123 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "height", + "range": [ + 124, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 136, + 139 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figcaption", + "range": [ + 140, + 150 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 152, + 157 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "caption", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 31 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figcaption", + "range": [ + 168, + 178 + ], + "loc": { + "start": { + "line": 9, + "column": 31 + }, + "end": { + "line": 9, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 41 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 179, + 181 + ], + "loc": { + "start": { + "line": 9, + "column": 42 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figure", + "range": [ + 183, + 189 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 191, + 192 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 192, + 200 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 201, + 203 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#each", + "range": [ + 204, + 209 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "images", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "as", + "range": [ + 217, + 219 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 13, + "column": 22 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 229, + 232 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 233, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "href", + "range": [ + 239, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "a", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "href", + "range": [ + 250, + 254 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 256, + 261 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "href", + "range": [ + 262, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t\t", + "range": [ + 268, + 272 + ], + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 272, + 273 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 4 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 273, + 280 + ], + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "figure", + "range": [ + 281, + 287 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 293, + 294 + ], + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 295, + 298 + ], + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 298, + 299 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "a", + "range": [ + 300, + 301 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 301, + 302 + ], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 304, + 305 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":else", + "range": [ + 305, + 310 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 310, + 311 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 315, + 322 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "figure", + "range": [ + 323, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 329, + 330 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "image", + "range": [ + 330, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 335, + 336 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 336, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 24 + }, + "end": { + "line": 19, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 340, + 343 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 345, + 346 + ], + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/each", + "range": [ + 346, + 351 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + } + } + ], + "range": [ + 0, + 353 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 22, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json new file mode 100644 index 00000000..d6664fe6 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json @@ -0,0 +1,2223 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "figure", + "identifiers": [ + { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -303, + -291 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -284, + -268 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -259, + -245 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -235, + -220 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -201, + -185 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 23, + 98 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 98 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 6, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 281, + 287 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 323, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "images", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "image", + "identifiers": [ + { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -303, + -291 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -284, + -268 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -259, + -245 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -235, + -220 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -201, + -185 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 23, + 98 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 98 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 6, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 50, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 94, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 118, + 123 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 152, + 157 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 50, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 94, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 118, + 123 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 152, + 157 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + } + ], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "image", + "identifiers": [ + { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + "node": { + "type": "SvelteEachBlock", + "expression": { + "type": "Identifier", + "name": "images", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "context": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + "index": null, + "key": null, + "children": [ + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 233, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "href", + "range": [ + 239, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "range": [ + 233, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "a", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "href", + "range": [ + 250, + 254 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "image", + "range": [ + 256, + 261 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "href", + "range": [ + 262, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + "range": [ + 256, + 266 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + "range": [ + 255, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 22 + } + } + } + ], + "range": [ + 250, + 267 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 22 + } + } + } + ], + "selfClosing": false, + "range": [ + 247, + 268 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t\t", + "range": [ + 268, + 272 + ], + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 16, + "column": 3 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": { + "type": "Identifier", + "name": "image", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + "callee": { + "type": "Identifier", + "name": "figure", + "range": [ + 281, + 287 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "range": [ + 272, + 295 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 295, + 298 + ], + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 17, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 298, + 302 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + "range": [ + 247, + 302 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 6 + } + } + } + ], + "else": { + "type": "SvelteElseBlock", + "elseif": false, + "children": [ + { + "type": "SvelteRenderTag", + "argument": { + "type": "Identifier", + "name": "image", + "range": [ + 330, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "callee": { + "type": "Identifier", + "name": "figure", + "range": [ + 323, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "range": [ + 314, + 337 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 25 + } + } + } + ], + "range": [ + 304, + 339 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + "range": [ + 228, + 344 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 20, + "column": 6 + } + } + } + ], + "else": null, + "range": [ + 203, + 352 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 21, + "column": 7 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 233, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 256, + 261 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 330, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 233, + 238 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 256, + 261 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 281, + 287 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 256, + 261 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 281, + 287 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + } + ] + }, + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 323, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 330, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 323, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "image", + "range": [ + 330, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "image", + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 281, + 287 + ], + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "figure", + "range": [ + 323, + 329 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "images", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "images", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/02-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-input.svelte new file mode 100644 index 00000000..8fa43ec6 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-input.svelte @@ -0,0 +1,6 @@ +{#snippet figure({ src, caption, width, height })} +
+ {caption} +
{caption}
+
+{/snippet} diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/02-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-no-unused-vars-result.json new file mode 100644 index 00000000..4581ef11 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "figure", + "line": 1, + "column": 11 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/02-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-output.json new file mode 100644 index 00000000..7ae7cabe --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-output.json @@ -0,0 +1,1844 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "figure", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 52, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 60, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "img", + "range": [ + 64, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "alt", + "range": [ + 68, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "caption", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "range": [ + 72, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 20 + } + } + } + ], + "range": [ + 68, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "SvelteShorthandAttribute", + "key": { + "type": "Identifier", + "name": "src", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "value": { + "type": "Identifier", + "name": "src", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "range": [ + 82, + 87 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + { + "type": "SvelteShorthandAttribute", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "value": { + "type": "Identifier", + "name": "width", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "range": [ + 88, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "SvelteShorthandAttribute", + "key": { + "type": "Identifier", + "name": "height", + "range": [ + 97, + 103 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + "value": { + "type": "Identifier", + "name": "height", + "range": [ + 97, + 103 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + "range": [ + 96, + 104 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 43 + } + } + } + ], + "selfClosing": true, + "range": [ + 63, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 46 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 63, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 46 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 107, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 46 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "figcaption", + "range": [ + 111, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 110, + 122 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "caption", + "range": [ + 123, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 122, + 131 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 131, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + "range": [ + 110, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 144, + 146 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 146, + 155 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "range": [ + 52, + 155 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + } + ], + "context": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "src", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "src", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "width", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "height", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "height", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "range": [ + 17, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "id": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 166 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 10 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "src", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "height", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figure", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 60, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "img", + "range": [ + 64, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "alt", + "range": [ + 68, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "caption", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "src", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "width", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "height", + "range": [ + 97, + 103 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 3, + "column": 42 + }, + "end": { + "line": 3, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 44 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 45 + }, + "end": { + "line": 3, + "column": 46 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 107, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 46 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figcaption", + "range": [ + 111, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "caption", + "range": [ + 123, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figcaption", + "range": [ + 133, + 143 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 144, + 146 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "figure", + "range": [ + 148, + 154 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 157, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 165, + 166 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + } + ], + "range": [ + 0, + 167 + ], + "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/docs/snippets/02-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json new file mode 100644 index 00000000..d52bdbf0 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json @@ -0,0 +1,1369 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "figure", + "identifiers": [ + { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "figure", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -94, + -84 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -85, + -77 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -79, + -69 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -71, + -60 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -44, + -34 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 49, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 39 + } + } + } + } + ], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "src", + "identifiers": [ + { + "type": "Identifier", + "name": "src", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "src", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -94, + -84 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -85, + -77 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -79, + -69 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -71, + -60 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -44, + -34 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 49, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "src", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "src", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + } + ] + }, + { + "name": "caption", + "identifiers": [ + { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -94, + -84 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -85, + -77 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -79, + -69 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -71, + -60 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -44, + -34 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 49, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "caption", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "caption", + "range": [ + 123, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + } + ] + }, + { + "name": "width", + "identifiers": [ + { + "type": "Identifier", + "name": "width", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "width", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -94, + -84 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -85, + -77 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -79, + -69 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -71, + -60 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -44, + -34 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 49, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "width", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "width", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + } + ] + }, + { + "name": "height", + "identifiers": [ + { + "type": "Identifier", + "name": "height", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "height", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -94, + -84 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -85, + -77 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -79, + -69 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -71, + -60 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -44, + -34 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 49, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "height", + "range": [ + 97, + 103 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "height", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "caption", + "range": [ + 73, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "src", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "src", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "width", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "width", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "height", + "range": [ + 97, + 103 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "height", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "caption", + "range": [ + 123, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "caption", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-input.svelte new file mode 100644 index 00000000..9011825c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-input.svelte @@ -0,0 +1,10 @@ + + +{#snippet hello(name)} +

hello {name}! {message}!

+{/snippet} + +{@render hello('alice')} +{@render hello('bob')} diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-output.json new file mode 100644 index 00000000..c83771cf --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-output.json @@ -0,0 +1,1856 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "right": { + "type": "TemplateLiteral", + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "tail": true, + "value": { + "cooked": "it's great to see you!", + "raw": "it's great to see you!" + }, + "range": [ + 26, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "range": [ + 26, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "range": [ + 16, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "range": [ + 16, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "range": [ + 14, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "optional": false, + "range": [ + 55, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + "range": [ + 14, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 54 + } + } + } + ], + "range": [ + 10, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 65, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 74 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 74, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 100, + 103 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "hello ", + "range": [ + 103, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "name", + "range": [ + 110, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "range": [ + 109, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "SvelteText", + "value": "! ", + "range": [ + 115, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 118, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "range": [ + 117, + 126 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "SvelteText", + "value": "!", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 28 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 127, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 28 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + "range": [ + 100, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 32 + } + } + } + ], + "context": { + "type": "Identifier", + "name": "name", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "range": [ + 76, + 142 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 142, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": { + "type": "Literal", + "raw": "'alice'", + "value": "alice", + "range": [ + 159, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 22 + } + } + }, + "callee": { + "type": "Identifier", + "name": "hello", + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "range": [ + 144, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": { + "type": "Literal", + "raw": "'bob'", + "value": "bob", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "callee": { + "type": "Identifier", + "name": "hello", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "range": [ + 169, + 191 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 22 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Template", + "value": "`it's great to see you!`", + "range": [ + 26, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 54 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 67, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 74, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 77, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "hello", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 110, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "HTMLText", + "value": "!", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 118, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 27 + } + } + }, + { + "type": "HTMLText", + "value": "!", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 28 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 128, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 29 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 133, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 142, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "String", + "value": "'alice'", + "range": [ + 159, + 166 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 170, + 177 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "hello", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "String", + "value": "'bob'", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 22 + } + } + } + ], + "range": [ + 0, + 192 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-prefer-const-result.json new file mode 100644 index 00000000..a82ec2e4 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "message", + "line": 2, + "column": 8 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json new file mode 100644 index 00000000..f2f80470 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json @@ -0,0 +1,1155 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "message", + "identifiers": [ + { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "right": { + "type": "TemplateLiteral", + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "tail": true, + "value": { + "cooked": "it's great to see you!", + "raw": "it's great to see you!" + }, + "range": [ + 26, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "range": [ + 26, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "range": [ + 16, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + "range": [ + 16, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + ], + "range": [ + 14, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "optional": false, + "range": [ + 55, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + "range": [ + 14, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 54 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 118, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ] + }, + { + "name": "hello", + "identifiers": [ + { + "type": "Identifier", + "name": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -6, + 1 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 2, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "range": [ + 97, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 77, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 6, + "column": 17 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "hello", + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "hello", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "hello", + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "hello", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "hello", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "name", + "identifiers": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 20 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "name", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -6, + 1 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 2, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ], + "range": [ + 97, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 77, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 6, + "column": 17 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "name", + "range": [ + 110, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "name", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 20 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "name", + "range": [ + 110, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "name", + "range": [ + 92, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 20 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 118, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 118, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-input.svelte new file mode 100644 index 00000000..f8e95b3c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-input.svelte @@ -0,0 +1,14 @@ +
+ {#snippet x()} + {#snippet y()}...{/snippet} + + + {@render y()} + {/snippet} + + + {@render y()} +
+ + +{@render x()} diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-no-undef-result.json new file mode 100644 index 00000000..55fca129 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "y", + "line": 10, + "column": 11 + }, + { + "ruleId": "no-undef", + "code": "x", + "line": 14, + "column": 10 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-no-unused-vars-result.json new file mode 100644 index 00000000..43edb79f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "x", + "line": 2, + "column": 12 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-output.json new file mode 100644 index 00000000..6bb3d37d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-output.json @@ -0,0 +1,1487 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "div", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 19 + } + } + } + ], + "context": null, + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "range": [ + 24, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t\t", + "range": [ + 51, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": " this is fine ", + "range": [ + 55, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 76, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": null, + "callee": { + "type": "Identifier", + "name": "y", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "range": [ + 79, + 92 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 15 + } + } + } + ], + "context": null, + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "range": [ + 7, + 104 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": " this will error, as `y` is not in scope ", + "range": [ + 107, + 155 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 49 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 155, + 157 + ], + "loc": { + "start": { + "line": 9, + "column": 49 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": null, + "callee": { + "type": "Identifier", + "name": "y", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "range": [ + 157, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 11, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 171, + 177 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "range": [ + 0, + 177 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 177, + 179 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": " this will also error, as `x` is not in scope ", + "range": [ + 179, + 232 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 53 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 13, + "column": 53 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": null, + "callee": { + "type": "Identifier", + "name": "x", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "range": [ + 233, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 13 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 25, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 42, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t\t", + "range": [ + 51, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 55, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 76, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 80, + 87 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 95, + 103 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 107, + 155 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 49 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 155, + 157 + ], + "loc": { + "start": { + "line": 9, + "column": 49 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 158, + 165 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "div", + "range": [ + 173, + 176 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 177, + 179 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 179, + 232 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 53 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 13, + "column": 53 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 233, + 234 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 234, + 241 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + } + } + ], + "range": [ + 0, + 247 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json new file mode 100644 index 00000000..044a04d7 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json @@ -0,0 +1,578 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "x", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "block", + "variables": [ + { + "name": "x", + "identifiers": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + -450, + -448 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + -462, + -448 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -400, + -394 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + -227, + -205 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + -239, + -205 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + } + ], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "y", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "y", + "identifiers": [ + { + "type": "Identifier", + "name": "y", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "y", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + -450, + -448 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + -462, + -448 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "y", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "y", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "y", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "y", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "y", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "y", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "from": "block", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "x", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "y", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "from": "block", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "x", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-input.svelte new file mode 100644 index 00000000..9a97064c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-input.svelte @@ -0,0 +1,14 @@ +{#snippet blastoff()} + 🚀 +{/snippet} + +{#snippet countdown(n)} + {#if n > 0} + {n}... + {@render countdown(n - 1)} + {:else} + {@render blastoff()} + {/if} +{/snippet} + +{@render countdown(10)} diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-output.json new file mode 100644 index 00000000..a661c203 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-output.json @@ -0,0 +1,2015 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "span", + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "🚀", + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 31, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "range": [ + 23, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "context": null, + "id": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "operator": ">", + "right": { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 81, + 86 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "span", + "range": [ + 91, + 95 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 90, + 96 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "n", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "range": [ + 96, + 99 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": "...", + "range": [ + 99, + 102 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 102, + 109 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 90, + 109 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 109, + 112 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "operator": "-", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "range": [ + 131, + 136 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "callee": { + "type": "Identifier", + "name": "countdown", + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "range": [ + 112, + 138 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 28 + } + } + } + ], + "else": { + "type": "SvelteElseBlock", + "elseif": false, + "children": [ + { + "type": "SvelteRenderTag", + "argument": null, + "callee": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 159, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "range": [ + 150, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 22 + } + } + } + ], + "range": [ + 140, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + "range": [ + 76, + 177 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 11, + "column": 6 + } + } + } + ], + "context": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "id": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "range": [ + 51, + 188 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 188, + 190 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "SvelteRenderTag", + "argument": { + "type": "Literal", + "raw": "10", + "value": 10, + "range": [ + 209, + 211 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + "callee": { + "type": "Identifier", + "name": "countdown", + "range": [ + 199, + 208 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "range": [ + 190, + 213 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "span", + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "🚀", + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "span", + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 52, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 77, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "n", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "span", + "range": [ + 91, + 95 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "n", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 99, + 102 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "span", + "range": [ + 104, + 108 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 109, + 112 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 113, + 120 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "countdown", + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "n", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "-", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": ":else", + "range": [ + 141, + 146 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 151, + 158 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "blastoff", + "range": [ + 159, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 173, + 176 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 179, + 187 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 188, + 190 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 14, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 191, + 198 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "countdown", + "range": [ + 199, + 208 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 209, + 211 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + ], + "range": [ + 0, + 214 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json new file mode 100644 index 00000000..d3a381f1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json @@ -0,0 +1,1172 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "blastoff", + "identifiers": [ + { + "type": "Identifier", + "name": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 0 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 159, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ] + }, + { + "name": "countdown", + "identifiers": [ + { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": null, + "test": null, + "range": [ + -105, + -71 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "BlockStatement", + "body": null, + "range": [ + -43, + -28 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 73, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 52, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "countdown", + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "countdown", + "range": [ + 199, + 208 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "countdown", + "range": [ + 199, + 208 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "n", + "identifiers": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": null, + "test": null, + "range": [ + -105, + -71 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "BlockStatement", + "body": null, + "range": [ + -43, + -28 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + 73, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 52, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "countdown", + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "countdown", + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "n", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "n", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + } + ] + }, + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 159, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 159, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "countdown", + "range": [ + 121, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "countdown", + "range": [ + 61, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 159, + 167 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "blastoff", + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-input.svelte new file mode 100644 index 00000000..7ed42dcf --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-input.svelte @@ -0,0 +1,25 @@ + + +{#snippet header()} + fruit + qty + price + total +{/snippet} + +{#snippet row(d)} + {d.name} + {d.qty} + {d.price} + {d.qty * d.price} +{/snippet} + + diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-output.json new file mode 100644 index 00000000..519bfa19 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-output.json @@ -0,0 +1,5692 @@ +{ + "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": "'./Table.svelte'", + "value": "./Table.svelte", + "range": [ + 28, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "Table", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "range": [ + 10, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "init": { + "type": "ArrayExpression", + "elements": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "'apples'", + "value": "apples", + "range": [ + 75, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "range": [ + 69, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "qty", + "range": [ + 85, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "5", + "value": 5, + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "price", + "range": [ + 93, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + "range": [ + 93, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 36 + } + } + } + ], + "range": [ + 67, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "'bananas'", + "value": "bananas", + "range": [ + 115, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 109, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "qty", + "range": [ + 126, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "10", + "value": 10, + "range": [ + 131, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 28 + } + } + }, + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 28 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "price", + "range": [ + 135, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 37 + }, + "end": { + "line": 6, + "column": 38 + } + } + }, + "range": [ + 135, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 38 + } + } + } + ], + "range": [ + 107, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 151, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "'cherries'", + "value": "cherries", + "range": [ + 157, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + "range": [ + 151, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "qty", + "range": [ + 169, + 172 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "20", + "value": 20, + "range": [ + 174, + 176 + ], + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "price", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 36 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "0.5", + "value": 0.5, + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 7, + "column": 38 + }, + "end": { + "line": 7, + "column": 41 + } + } + }, + "range": [ + 178, + 188 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 41 + } + } + } + ], + "range": [ + 149, + 190 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 43 + } + } + } + ], + "range": [ + 63, + 193 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "range": [ + 54, + 193 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "range": [ + 48, + 194 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 195, + 204 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 204 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 204, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 228, + 230 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 227, + 231 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "fruit", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 236, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + "range": [ + 227, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 241, + 243 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 244, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 243, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "qty", + "range": [ + 247, + 250 + ], + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 8 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 250, + 255 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "range": [ + 243, + 255 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 255, + 257 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 258, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 257, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "price", + "range": [ + 261, + 266 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 10 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 266, + 271 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + "range": [ + 257, + 271 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 271, + 273 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 274, + 276 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 273, + 277 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "total", + "range": [ + 277, + 282 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 10 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 282, + 287 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + "range": [ + 273, + 287 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 15 + } + } + } + ], + "context": null, + "id": { + "type": "Identifier", + "name": "header", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + "range": [ + 206, + 298 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 298, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 320, + 322 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 319, + 323 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 324, + 325 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 326, + 330 + ], + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 12 + } + } + }, + "range": [ + 324, + 330 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 12 + } + } + }, + "range": [ + 323, + 331 + ], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 13 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 331, + 336 + ], + "loc": { + "start": { + "line": 19, + "column": 13 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "range": [ + 319, + 336 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 336, + 338 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 339, + 341 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 338, + 342 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "qty", + "range": [ + 345, + 348 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + "range": [ + 343, + 348 + ], + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + "range": [ + 342, + 349 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 12 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 349, + 354 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 17 + } + } + }, + "range": [ + 338, + 354 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 17 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 354, + 356 + ], + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 357, + 359 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 356, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 361, + 362 + ], + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "price", + "range": [ + 363, + 368 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "range": [ + 361, + 368 + ], + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "range": [ + 360, + 369 + ], + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 369, + 374 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + "range": [ + 356, + 374 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 374, + 376 + ], + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 377, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 376, + 380 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 381, + 382 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "qty", + "range": [ + 383, + 386 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + "range": [ + 381, + 386 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + "operator": "*", + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 389, + 390 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "price", + "range": [ + 391, + 396 + ], + "loc": { + "start": { + "line": 22, + "column": 16 + }, + "end": { + "line": 22, + "column": 21 + } + } + }, + "range": [ + 389, + 396 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 21 + } + } + }, + "range": [ + 381, + 396 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 21 + } + } + }, + "range": [ + 380, + 397 + ], + "loc": { + "start": { + "line": 22, + "column": 5 + }, + "end": { + "line": 22, + "column": 22 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 397, + 402 + ], + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + "range": [ + 376, + 402 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 27 + } + } + } + ], + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + "id": { + "type": "Identifier", + "name": "row", + "range": [ + 310, + 313 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "range": [ + 300, + 413 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 413, + 415 + ], + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 25, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "Table", + "range": [ + 416, + 421 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "data", + "range": [ + 422, + 426 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 11 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "fruits", + "range": [ + 428, + 434 + ], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + "range": [ + 427, + 435 + ], + "loc": { + "start": { + "line": 25, + "column": 12 + }, + "end": { + "line": 25, + "column": 20 + } + } + } + ], + "range": [ + 422, + 435 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + { + "type": "SvelteShorthandAttribute", + "key": { + "type": "Identifier", + "name": "header", + "range": [ + 437, + 443 + ], + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 28 + } + } + }, + "value": { + "type": "Identifier", + "name": "header", + "range": [ + 437, + 443 + ], + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 28 + } + } + }, + "range": [ + 436, + 444 + ], + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 29 + } + } + }, + { + "type": "SvelteShorthandAttribute", + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 446, + 449 + ], + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 34 + } + } + }, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 446, + 449 + ], + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 34 + } + } + }, + "range": [ + 445, + 450 + ], + "loc": { + "start": { + "line": 25, + "column": 30 + }, + "end": { + "line": 25, + "column": 35 + } + } + } + ], + "selfClosing": true, + "range": [ + 415, + 453 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 38 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 415, + 453 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 38 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "import", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "Table", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "from", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "String", + "value": "'./Table.svelte'", + "range": [ + 28, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "String", + "value": "'apples'", + "range": [ + 75, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "qty", + "range": [ + 85, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Numeric", + "value": "5", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "price", + "range": [ + 93, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 5, + "column": 34 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "String", + "value": "'bananas'", + "range": [ + 115, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "qty", + "range": [ + 126, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 131, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 28 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "price", + "range": [ + 135, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 6, + "column": 35 + }, + "end": { + "line": 6, + "column": 36 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 37 + }, + "end": { + "line": 6, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 145, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 40 + }, + "end": { + "line": 6, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 151, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "String", + "value": "'cherries'", + "range": [ + 157, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "qty", + "range": [ + 169, + 172 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": "Numeric", + "value": "20", + "range": [ + 174, + 176 + ], + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "price", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 7, + "column": 36 + }, + "end": { + "line": 7, + "column": 37 + } + } + }, + { + "type": "Numeric", + "value": "0.5", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 7, + "column": 38 + }, + "end": { + "line": 7, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 7, + "column": 42 + }, + "end": { + "line": 7, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 193, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 197, + 203 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 204, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 207, + 215 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "header", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 228, + 230 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 230, + 231 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "fruit", + "range": [ + 231, + 236 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 237, + 238 + ], + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 238, + 240 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 240, + 241 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 241, + 243 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 244, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "qty", + "range": [ + 247, + 250 + ], + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 252, + 254 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 255, + 257 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 257, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 258, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "price", + "range": [ + 261, + 266 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 268, + 270 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 270, + 271 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 271, + 273 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 273, + 274 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 274, + 276 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "total", + "range": [ + 277, + 282 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 284, + 286 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 288, + 289 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 289, + 297 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 297, + 298 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 298, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 18, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 300, + 301 + ], + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 301, + 309 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 310, + 313 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 313, + 314 + ], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 315, + 316 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 316, + 317 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 319, + 320 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 320, + 322 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 322, + 323 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 323, + 324 + ], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 324, + 325 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 325, + 326 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 326, + 330 + ], + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 330, + 331 + ], + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 19, + "column": 13 + }, + "end": { + "line": 19, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 332, + 333 + ], + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 333, + 335 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 335, + 336 + ], + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 336, + 338 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 338, + 339 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 339, + 341 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 342, + 343 + ], + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 344, + 345 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "qty", + "range": [ + 345, + 348 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 348, + 349 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 349, + 350 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 350, + 351 + ], + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 14 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 351, + 353 + ], + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 353, + 354 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 354, + 356 + ], + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 356, + 357 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 357, + 359 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 359, + 360 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 360, + 361 + ], + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 361, + 362 + ], + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 362, + 363 + ], + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "price", + "range": [ + 363, + 368 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 368, + 369 + ], + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 370, + 371 + ], + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 371, + 373 + ], + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 373, + 374 + ], + "loc": { + "start": { + "line": 21, + "column": 18 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 374, + 376 + ], + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 376, + 377 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 377, + 379 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 379, + 380 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 380, + 381 + ], + "loc": { + "start": { + "line": 22, + "column": 5 + }, + "end": { + "line": 22, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 381, + 382 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 382, + 383 + ], + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "qty", + "range": [ + 383, + 386 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 387, + 388 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 389, + 390 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 390, + 391 + ], + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "price", + "range": [ + 391, + 396 + ], + "loc": { + "start": { + "line": 22, + "column": 16 + }, + "end": { + "line": 22, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 396, + 397 + ], + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 397, + 398 + ], + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 398, + 399 + ], + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 24 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 399, + 401 + ], + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 401, + 402 + ], + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 403, + 404 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 404, + 412 + ], + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 412, + 413 + ], + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 413, + 415 + ], + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 25, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 415, + 416 + ], + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "Table", + "range": [ + 416, + 421 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "data", + "range": [ + 422, + 426 + ], + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 426, + 427 + ], + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 427, + 428 + ], + "loc": { + "start": { + "line": 25, + "column": 12 + }, + "end": { + "line": 25, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "fruits", + "range": [ + 428, + 434 + ], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 434, + 435 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 436, + 437 + ], + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "header", + "range": [ + 437, + 443 + ], + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 443, + 444 + ], + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 445, + 446 + ], + "loc": { + "start": { + "line": 25, + "column": 30 + }, + "end": { + "line": 25, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 446, + 449 + ], + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 449, + 450 + ], + "loc": { + "start": { + "line": 25, + "column": 34 + }, + "end": { + "line": 25, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 451, + 452 + ], + "loc": { + "start": { + "line": 25, + "column": 36 + }, + "end": { + "line": 25, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 452, + 453 + ], + "loc": { + "start": { + "line": 25, + "column": 37 + }, + "end": { + "line": 25, + "column": 38 + } + } + } + ], + "range": [ + 0, + 454 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 26, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json new file mode 100644 index 00000000..e618d0c1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json @@ -0,0 +1,2064 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "Table", + "identifiers": [ + { + "type": "Identifier", + "name": "Table", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "ImportBinding", + "name": { + "type": "Identifier", + "name": "Table", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "node": { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "Table", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 416, + 421 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Table", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ] + }, + { + "name": "fruits", + "identifiers": [ + { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "init": { + "type": "ArrayExpression", + "elements": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "'apples'", + "value": "apples", + "range": [ + 75, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "range": [ + 69, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "qty", + "range": [ + 85, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "5", + "value": 5, + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "price", + "range": [ + 93, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "2", + "value": 2, + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + "range": [ + 93, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 36 + } + } + } + ], + "range": [ + 67, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "'bananas'", + "value": "bananas", + "range": [ + 115, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + "range": [ + 109, + 124 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "qty", + "range": [ + 126, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "10", + "value": 10, + "range": [ + 131, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 28 + } + } + }, + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 28 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "price", + "range": [ + 135, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 35 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 37 + }, + "end": { + "line": 6, + "column": 38 + } + } + }, + "range": [ + 135, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 38 + } + } + } + ], + "range": [ + 107, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "name", + "range": [ + 151, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "'cherries'", + "value": "cherries", + "range": [ + 157, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + "range": [ + 151, + 167 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "qty", + "range": [ + 169, + 172 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "20", + "value": 20, + "range": [ + 174, + 176 + ], + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "price", + "range": [ + 178, + 183 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 36 + } + } + }, + "method": false, + "shorthand": false, + "value": { + "type": "Literal", + "raw": "0.5", + "value": 0.5, + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 7, + "column": 38 + }, + "end": { + "line": 7, + "column": 41 + } + } + }, + "range": [ + 178, + 188 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 41 + } + } + } + ], + "range": [ + 149, + 190 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 43 + } + } + } + ], + "range": [ + 63, + 193 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "range": [ + 54, + 193 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 428, + 434 + ], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + } + ] + }, + { + "name": "header", + "identifiers": [ + { + "type": "Identifier", + "name": "header", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 16 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "header", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 224, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 12, + "column": 0 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 207, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 12, + "column": 0 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "header", + "range": [ + 437, + 443 + ], + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "header", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 16 + } + } + } + } + ] + }, + { + "name": "row", + "identifiers": [ + { + "type": "Identifier", + "name": "row", + "range": [ + 310, + 313 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "row", + "range": [ + 310, + 313 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 170, + 178 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 31 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 188, + 198 + ], + "loc": { + "start": { + "line": 7, + "column": 41 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 208, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 12, + "column": 0 + } + } + } + ], + "range": [ + 316, + 363 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 301, + 363 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 21, + "column": 8 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 446, + 449 + ], + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 34 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 310, + 313 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 428, + 434 + ], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "fruits", + "range": [ + 54, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "header", + "range": [ + 437, + 443 + ], + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 28 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "header", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 446, + 449 + ], + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 34 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 310, + 313 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 416, + 421 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "Table", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "d", + "identifiers": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 170, + 178 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 31 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 188, + 198 + ], + "loc": { + "start": { + "line": 7, + "column": 41 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + 208, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 12, + "column": 0 + } + } + } + ], + "range": [ + 316, + 363 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 301, + 363 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 21, + "column": 8 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 324, + 325 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 361, + 362 + ], + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 381, + 382 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 389, + 390 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 324, + 325 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 361, + 362 + ], + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 381, + 382 + ], + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 389, + 390 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-input.svelte new file mode 100644 index 00000000..904c06b1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-input.svelte @@ -0,0 +1,16 @@ + +
+ {#snippet header()} + + + + + {/snippet} + + {#snippet row(d)} + + + + + {/snippet} +
fruitqtypricetotal{d.name}{d.qty}{d.price}{d.qty * d.price}
diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-no-undef-result.json new file mode 100644 index 00000000..d9ed3e84 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "Table", + "line": 2, + "column": 2 + }, + { + "ruleId": "no-undef", + "code": "fruits", + "line": 2, + "column": 14 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-output.json new file mode 100644 index 00000000..882c89fa --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-output.json @@ -0,0 +1,3760 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteHTMLComment", + "value": " this is semantically the same as the above ", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "Table", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "data", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "fruits", + "range": [ + 65, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "range": [ + 64, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 20 + } + } + } + ], + "range": [ + 59, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 20 + } + } + } + ], + "selfClosing": false, + "range": [ + 52, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 73, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 98, + 100 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 97, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "fruit", + "range": [ + 101, + 106 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 106, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "range": [ + 97, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 111, + 114 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 115, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 114, + 118 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "qty", + "range": [ + 118, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 9 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 121, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + "range": [ + 114, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 126, + 129 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 130, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 129, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "price", + "range": [ + 133, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 138, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "range": [ + 129, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 143, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 147, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 146, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "total", + "range": [ + 150, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 11 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 155, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + "range": [ + 146, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 16 + } + } + } + ], + "context": null, + "id": { + "type": "Identifier", + "name": "header", + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + "range": [ + 75, + 172 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "SvelteSnippetBlock", + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 196, + 198 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 195, + 199 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 202, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + "range": [ + 200, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + "range": [ + 199, + 207 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 14 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 14 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + "range": [ + 195, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 212, + 215 + ], + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 216, + 218 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 215, + 219 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "qty", + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + "range": [ + 220, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + "range": [ + 219, + 226 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 13 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 226, + 231 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + "range": [ + 215, + 231 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 231, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 235, + 237 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 234, + 238 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 239, + 240 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "price", + "range": [ + 241, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + "range": [ + 239, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + "range": [ + 238, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 15 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 247, + 252 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + "range": [ + 234, + 252 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 252, + 255 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "td", + "range": [ + 256, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 255, + 259 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "children": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "qty", + "range": [ + 262, + 265 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + "range": [ + 260, + 265 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + "operator": "*", + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "price", + "range": [ + 270, + 275 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + "range": [ + 268, + 275 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + "range": [ + 260, + 275 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + "range": [ + 259, + 276 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 276, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "range": [ + 255, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 28 + } + } + } + ], + "context": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "id": { + "type": "Identifier", + "name": "row", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "range": [ + 175, + 293 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 293, + 294 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 16, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 294, + 302 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "range": [ + 52, + 302 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 16, + "column": 8 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "HTMLComment", + "value": "", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "Table", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "data", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "fruits", + "range": [ + 65, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 73, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 76, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "header", + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 91, + 92 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 98, + 100 + ], + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "fruit", + "range": [ + 101, + 106 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 108, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 111, + 114 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 115, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "qty", + "range": [ + 118, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 123, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 126, + 129 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 130, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "price", + "range": [ + 133, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 138, + 139 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 140, + 142 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 143, + 146 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 147, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "total", + "range": [ + 150, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 157, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 163, + 171 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t", + "range": [ + 172, + 175 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 176, + 184 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 191, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 196, + 198 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 202, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 207, + 208 + ], + "loc": { + "start": { + "line": 11, + "column": 14 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 209, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 212, + 215 + ], + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 216, + 218 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 218, + 219 + ], + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 219, + 220 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 221, + 222 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "qty", + "range": [ + 222, + 225 + ], + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 227, + 228 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 228, + 230 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 230, + 231 + ], + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 231, + 234 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 234, + 235 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 235, + 237 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 237, + 238 + ], + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 239, + 240 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 240, + 241 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "price", + "range": [ + 241, + 246 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 247, + 248 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 17 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 249, + 251 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 252, + 255 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 256, + 258 + ], + "loc": { + "start": { + "line": 14, + "column": 3 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "qty", + "range": [ + 262, + 265 + ], + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 266, + 267 + ], + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 269, + 270 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "price", + "range": [ + 270, + 275 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "td", + "range": [ + 278, + 280 + ], + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 14, + "column": 27 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 284, + 292 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 293, + 294 + ], + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 16, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 295, + 296 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "Table", + "range": [ + 296, + 301 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 301, + 302 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + } + ], + "range": [ + 0, + 303 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 17, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json new file mode 100644 index 00000000..a765b752 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json @@ -0,0 +1,1153 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "block", + "variables": [ + { + "name": "header", + "identifiers": [ + { + "type": "Identifier", + "name": "header", + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "header", + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + -158, + -156 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + -175, + -156 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "header", + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "header", + "range": [ + 85, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + } + ] + }, + { + "name": "row", + "identifiers": [ + { + "type": "Identifier", + "name": "row", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "row", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -208, + -199 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -188, + -180 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -169, + -159 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -148, + -130 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + -60, + -13 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + -75, + -13 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 65, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "d", + "identifiers": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -208, + -199 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -188, + -180 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -169, + -159 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + { + "type": "ExpressionStatement", + "expression": null, + "range": [ + -148, + -130 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + ], + "range": [ + -60, + -13 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + -75, + -13 + ], + "loc": { + "start": { + "line": 0, + "column": null + }, + "end": { + "line": 0, + "column": null + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 239, + 240 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 239, + 240 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "d", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "d", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 65, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 65, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 65, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "block", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-input.svelte new file mode 100644 index 00000000..b3438c30 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-input.svelte @@ -0,0 +1,8 @@ + + + + + + + +
fruitqtypricetotal
diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-no-undef-result.json new file mode 100644 index 00000000..fb67fb01 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-no-undef-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-undef", + "code": "Table", + "line": 1, + "column": 2 + }, + { + "ruleId": "no-undef", + "code": "fruits", + "line": 1, + "column": 14 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-output.json new file mode 100644 index 00000000..5724a961 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-output.json @@ -0,0 +1,1584 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "Table", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "data", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "fruits", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 7, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "fruit", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 23, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 40, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 39, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "qty", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "range": [ + 39, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 51, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 54, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 53, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "price", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 62, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "range": [ + 53, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 67, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "th", + "range": [ + 70, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "total", + "range": [ + 73, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 10 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "range": [ + 69, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": " ... ", + "range": [ + 86, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 8, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 99, + 107 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + "range": [ + 0, + 107 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 8 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "Table", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "data", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "fruits", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "fruit", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 40, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "qty", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 48, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 51, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 54, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "price", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 64, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 67, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 70, + 72 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": "total", + "range": [ + 73, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "th", + "range": [ + 80, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t", + "range": [ + 83, + 86 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 86, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "Table", + "range": [ + 101, + 106 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 8 + } + } + } + ], + "range": [ + 0, + 108 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json new file mode 100644 index 00000000..6aaf22c7 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json @@ -0,0 +1,199 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "fruits", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "Table", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-input.svelte new file mode 100644 index 00000000..8c42057d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-input.svelte @@ -0,0 +1,13 @@ + + + + {#if children} + + {@render children()} + + {/if} + + +
diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-no-unused-vars-result.json new file mode 100644 index 00000000..b55e7b4a --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-no-unused-vars-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "data", + "line": 2, + "column": 8 + }, + { + "ruleId": "no-unused-vars", + "code": "row", + "line": 2, + "column": 24 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-output.json new file mode 100644 index 00000000..c5531576 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-output.json @@ -0,0 +1,1881 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ], + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + "range": [ + 14, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + ], + "range": [ + 10, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 40 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 50, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 0, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 59, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "table", + "range": [ + 62, + 67 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 61, + 68 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 68, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "Identifier", + "name": "children", + "range": [ + 75, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "thead", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 87, + 94 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\t\t", + "range": [ + 94, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "tr", + "range": [ + 99, + 101 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 98, + 102 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "children": [ + { + "type": "SvelteRenderTag", + "argument": null, + "callee": { + "type": "Identifier", + "name": "children", + "range": [ + 111, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 102, + 122 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 122, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + "range": [ + 98, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": "SvelteText", + "value": "\n\t\t", + "range": [ + 127, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 130, + 138 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + "range": [ + 87, + 138 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 9, + "column": 10 + } + } + } + ], + "else": null, + "range": [ + 70, + 145 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": " ... ", + "range": [ + 148, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 13, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 161, + 169 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + "range": [ + 61, + 169 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 8 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "$props", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 52, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 59, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 62, + 67 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 68, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 71, + 74 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 75, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t\t", + "range": [ + 94, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 99, + 101 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@render", + "range": [ + 103, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "children", + "range": [ + 111, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "tr", + "range": [ + 124, + 126 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 127, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "thead", + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 141, + 144 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 148, + 160 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "table", + "range": [ + 163, + 168 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + } + ], + "range": [ + 0, + 170 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-prefer-const-result.json new file mode 100644 index 00000000..7b3a2a44 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-prefer-const-result.json @@ -0,0 +1,20 @@ +[ + { + "ruleId": "prefer-const", + "code": "data", + "line": 2, + "column": 8 + }, + { + "ruleId": "prefer-const", + "code": "children", + "line": 2, + "column": 14 + }, + { + "ruleId": "prefer-const", + "code": "row", + "line": 2, + "column": 24 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json new file mode 100644 index 00000000..8d5fae8f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json @@ -0,0 +1,1457 @@ +{ + "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": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "data", + "identifiers": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ], + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + "range": [ + 14, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + }, + { + "name": "children", + "identifiers": [ + { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ], + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + "range": [ + 14, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 75, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 111, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + } + ] + }, + { + "name": "row", + "identifiers": [ + { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ], + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "$props", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "optional": false, + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + "range": [ + 14, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "data", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "row", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 75, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 111, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "children", + "range": [ + 111, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "children", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$props", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file