Add ability to rewrite JS files.

For https://webarchive.jira.com/browse/ARI-3762.