import * as t from '@babel/types' ; import * as helpers from '../helpers' ; import { NodePath } from '@babel/traverse' ; import JSXElement from './JSXElement' ; import JSXExpressionContainer from './JSXExpressionContainer' ; import { RenderNode , Options } from '../types' ; param element param { NodePath } path param { string } module param { ( Array < string | number > ) } dataPath returns { string } export function createTemplate ( element , path , dataPath , options ) { if ( t . isJSXElement ( element . node ) ) { return JSXElement ( element as RenderNode < t . JSXElement > , path , dataPath , createTemplate , options ) ; } if ( t . isJSXExpressionContainer ( element . node ) ) { return JSXExpressionContainer ( element . node , dataPath ) ; } if ( t . isJSXText ( element . node ) ) { return `{{'${ helpers . normalizeLiteral ( element . node . value ) }'}}` ; } return '' ; }