We need to mimic the behaviour of Node ESM resolution and my testing so far without the loader suggests that:
export * from only exports named exports and we don't need to pass through default exports
If there are duplicate named exports, none of these should be exported
Ideally we should have tests that ensure that module exports are identical both with and without the loader hook because currently this isn't the case.
To accomplish the above:
I've added mapExcludingDuplicates for setters which does as it suggests
Removed auto-renaming of default exports as this doesn't appear to be what Node does (ie. #68)
Use the export name as the Map key so we remove duplicates
In the emitted code, only add exports to _ if there a corresponding key in set. Without this, the exports passed to Hook don't match the final module exports
Closes #68, Closes #77, Closes #62, Closes #60...
We need to mimic the behaviour of Node ESM resolution and my testing so far without the loader suggests that:
export * from
only exports named exports and we don't need to pass through default exportsIdeally we should have tests that ensure that module exports are identical both with and without the loader hook because currently this isn't the case.
To accomplish the above:
mapExcludingDuplicates
forsetters
which does as it suggests_
if there a corresponding key inset
. Without this, the exports passed toHook
don't match the final module exports