Refine "require" / "import" conditions constraints
This PR follows up from the discussion in https://github.com/nodejs/modules/issues/556 in relaxing the constraint that "require"
and "import"
should be exhaustive and permitting other tools to decide to match neither of these conditions effectively.
The important property of mutual exclusivity remains though.
I also took the opportunity to clarify that "import"
applies for any top-level resolve or load operation in the ES module loader and that "require"
is able to resolve non-CommonJS formats, to try and make the fundamental definitions of these conditions clearer for tools etc.
It's a fine line between clarify and understandability here, another reason to work towards separating "guide" information from "api" information into two halves of this section ideally over time.
Feedback welcome.
//cc @nodejs/modules-active-members @lukastaegert @sokra.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
documentation is changed or added -
commit message follows commit guidelines