amberc.js: create resolve_file() function

refactoring of collect_js_files() and
collect_st_files()