add ElementWithPath interface

pull/14395/head
Rich Harris 10 months ago
parent eb59f72cb5
commit 8f02f1e8e4

@ -1,4 +1,4 @@
import type { AST, Binding, Css, SvelteNode, TemplateNode } from '#compiler';
import type { AST, Binding, Css, ElementWithPath, SvelteNode } from '#compiler';
import type { Identifier, LabeledStatement, Program, VariableDeclaration } from 'estree';
import type { Scope, ScopeRoot } from './scope.js';
@ -37,10 +37,7 @@ export interface ComponentAnalysis extends Analysis {
instance: Js;
template: Template;
/** Used for CSS pruning and scoping */
elements: Array<{
node: AST.RegularElement | AST.SvelteElement | AST.RenderTag;
path: SvelteNode[];
}>;
elements: ElementWithPath[];
runes: boolean;
exports: Array<{ name: string; alias: string | null }>;
/** Whether the component uses `$$props` */

@ -514,6 +514,11 @@ export type TemplateNode =
export type SvelteNode = Node | TemplateNode | AST.Fragment | Css.Node;
export interface ElementWithPath {
node: AST.RegularElement | AST.SvelteElement | AST.RenderTag;
path: SvelteNode[];
}
declare module 'estree' {
export interface BaseNode {
/** Added by the Svelte parser */

Loading…
Cancel
Save