import { AliasesMeta , AliasMapItem } from './shared-types' ; function normalizeAliasValue ( value ) { if ( value . endsWith ( '/*' ) ) return value . slice ( 0 , - 2 ) ; if ( value . endsWith ( '/' ) ) return value . slice ( 0 , - 1 ) ; return value ; } export function generateAliasesMeta ( paths ) { const aliasMap = [ ] ; for ( const aliasName in paths ) { const aliasPath = paths [ aliasName ] ; const [ normalizedAliasName , normalizedAliasPath ] = [ normalizeAliasValue ( aliasName ) , normalizeAliasValue ( aliasPath ) , ] ; aliasMap . push ( [ normalizedAliasName , normalizedAliasPath ] ) ; } return { aliasMap } ; }