fileoverview author Yosuke Ota
  import JSON5 from 'json5' ; import yaml from 'js-yaml' ; import type { AST as VAST } from 'vue-eslint-parser' ; import type { I18nLocaleMessageDictionary } from '../../types' ; function hasEndTag ( element ) { return ! ! element . endTag ; } param { RuleContext } context param { VElement } i18nBlock function parseValuesInI18nBlock ( i18nBlock , parse ) { if ( ! hasEndTag ( i18nBlock ) ) { return null ; } const text = i18nBlock . children [ 0 ] ; const sourceString = text != null && text . type === 'VText' ? text . value : '' ; if ( ! sourceString . trim ( ) ) { return null ; } try { return parse ( sourceString ) ; } catch ( e ) { return null ; } } param { VElement } i18nBlock export function parseJsonValuesInI18nBlock ( i18nBlock ) { return parseValuesInI18nBlock ( i18nBlock , code => JSON5 . parse ( code ) ) ; } param { VElement } i18nBlock export function parseYamlValuesInI18nBlock ( i18nBlock ) { return parseValuesInI18nBlock ( i18nBlock , code => yaml . load ( code ) as never ) ; }