import { RawVueFileName , VueTemplateFileName , CompiledVueTemplateFileName , TransformedCompiledVueTemplateFileName , TSVueFileName , VueScriptFileName , TransformedVueScriptFileName } from "../types" ; export const toRelativePath = ( str ) => str . replace ( process . cwd ( ) + "/" , "" ) ; export const toTSVueFIleName = ( fileName ) => `${ fileName }.ts` as TSVueFileName ; export const toVueTemplateFileName = ( fileName ) => `${ fileName }.template.ts` as VueTemplateFileName ; export const toVueScriptFileName = ( fileName ) => `${ fileName }.script.ts` as VueScriptFileName ; export const toCompiledVueTemplateFileName = ( fileName ) => fileName . replace ( /\.ts$/ , ".compiled.ts" ) as CompiledVueTemplateFileName ; export const toTransformedCompiledVueTemplateFileName = ( fileName ) => fileName . replace ( /\.compiled\.ts$/ , ".compiled.transformed.ts" ) as TransformedCompiledVueTemplateFileName ; export const toTransformedVueScriptFileName = ( fileName ) => fileName . replace ( /\.ts$/ , '.transformed.ts' ) as TransformedVueScriptFileName ; export const toRawVueFileName = ( fileName ) : RawVueFileName => { if ( isTSVueFile ( fileName ) ) { return fileName . replace ( /\.ts$/ , '' ) as RawVueFileName ; } else if ( isCompiledVueTemplateFile ( fileName ) ) { return fileName . replace ( /\.template\.compiled\.ts$/ , '' ) as RawVueFileName ; } else { throw new Error ( 'could not trnsform to raw vue file name' ) ; } } ; /**
 * User Type Guards
 */ export const isRawVueFile = ( fileName ) : fileName is RawVueFileName => /\.vue$/ . test ( fileName ) ; export const isTSVueFile = ( fileName ) : fileName is TSVueFileName => /\.vue\.ts$/ . test ( fileName ) ; export const isVueScriptFile = ( fileName ) : fileName is VueScriptFileName => /\.vue\.script\.ts$/ . test ( fileName ) ; export const isVueTemplateFile = ( fileName ) : fileName is VueTemplateFileName => /\.vue\.template\.ts$/ . test ( fileName ) ; export const isCompiledVueTemplateFile = ( fileName ) : fileName is CompiledVueTemplateFileName => /\.vue\.template\.compiled\.ts$/ . test ( fileName ) ;