module: add preImport loader hook
Adds a new preImport
loader hook which is called before each top-level import operation (dynamic and host-defined).
In the chaining model these hooks run in parallel and block subsequent module pipeline work for the graph until they all resolve. This allows tracking and resolution cache preparation.
The goal for this PR is to land an acceptable API that can then lead to the async resolve hook being entirely deprecated. If we can get to such a point we will then be able to obtain full alignment on import.meta.resolve
being sync.
This is a draft PR for now, with the docs and API changes untested simply to illustrate the concept. Tests will be fleshed out after further review if there is agreement on the overall shape.
//cc @nodejs/modules @nodejs/loaders