import { IGenerator } from "./generator" ; import { NodePath } from "@babel/core" ; import { JSXIdentifier , JSXClosingElement , jsxNamespacedName , jsxIdentifier , JSXAttribute , JSXElement , JSXExpressionContainer , } from "@babel/types" ; import { ToString } from "typedraft" ; export class ClosingElementVisitor { } < ClosingElementVisitor /> + function Visit ( e , generator ) { if ( ! e || ! e . node ) return ; const name = e . get ( "name" ) ; if ( ! name . isJSXIdentifier ( ) ) return ; const Append = generator . Append . bind ( generator ) ; const tag_name = name . node . name ; < HandleClosingElement />; } ; function HandleClosingElement ( tag_name , e , Append ) { "use match" ; ( tag_name ) => Append ( `{/${ tag_name }}` ) ; ( tag_name ) => Append ( "" ) ; ( tag_name ) => Append ( "}" ) ; ( ) => { if ( tag_name . startsWith ( "svelte" ) ) { const name = e . get ( "name" ) as NodePath < JSXIdentifier > ; name . node . name = tag_name . replace ( "-" , ":" ) ; } Append ( ToString ( e . node ) ) ; } ; }