Refactor several javascript files to ES module syntax
Follow up to !12581 (merged) which removes unnecessary globals and refactors scripts that rely on them into proper ES module exports.
Part of #33391 (closed) and #20983 (closed)
Follow up to !12581 (merged) which removes unnecessary globals and refactors scripts that rely on them into proper ES module exports.
Part of #33391 (closed) and #20983 (closed)