import { DefinitionAST , Mapper , Name , Rename , builders } from "../../BlockParser/ast" ; import { Block } from "../../BlockTree" ; export type PathResolver = ( block : Block , fromPath : string ) => string ; export class CompiledDefinitionMapper implements Mapper < DefinitionAST > { pathResolver : PathResolver ; block : Block ; constructor ( block , pathResolver ) { this . block = block ; this . pathResolver = pathResolver ; } BlockExport ( fromPath , exports ) { fromPath = this . pathResolver ( this . block , fromPath ) ; return builders . blockExport ( fromPath , exports ) ; } BlockReference ( fromPath , defaultName , references ) { fromPath = this . pathResolver ( this . block , fromPath ) ; return builders . blockReference ( fromPath , defaultName , references ) ; } }