Production builds: write endpoints all at once (#75304)
This implements a new napi binding, `project.writeAllEndpointsToDisk`
which writes chunks for all endpoints.
This avoids iterating over each endpoint and calling individual napi
bindings, each resulting in a call to `emit()`. While iterating entry
points now occurs in Rust, `OutputAssets` are collected in an `IndexSet`
to prevent unnecessary `emit()` calls. This also significantly reduces
unnecessary calls to the manifest loader from JS.
Test Plan: CI
Commit before removing merge commits:
https://github.com/vercel/next.js/pull/75304/commits/189743dd261a682c5cb0a46e69f27861c612e9c2
---------
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>