Port lib directory to javascript.