Simplify `buildEarlyExports`.

- Factor out common looping logic for early and late exports.
- Simplify determining the expression to assign to the export for early exports (it is always the function name).