fix(compartment-mapper): relativize all exports from package.json - undo the change allowing reexports of dependencies by just stating them in package.json "exports" field
MODIFY
packages/compartment-mapper/NEWS.md
packages/compartment-mapper/NEWS.md
@@ -15,6 +15,7 @@ User-visible changes to the compartment mapper:
We still allow for the possibility that these duplicates exist and in fact
may contain different sources, since they may be retained as dependencies
beyond the purview of npm.
+- A package.json file with the "type" field nested within a package's folder structure a is now taken into account when determining if a .js file is an ES module.
# 0.7.2 (2022-04-11)

MODIFY
packages/compartment-mapper/src/infer-exports.js
packages/compartment-mapper/src/infer-exports.js
@@ -45,7 +45,7 @@ function* interpretExports(name, exports, tags) {
}
}
if (typeof exports === 'string') {
- yield [name, exports];
+ yield [name, relativize(exports)];
return;
}
if (Object(exports) !== exports) {

ADD
packages/compartment-mapper/test/fixtures-retained/node_modules/mk1/index.js
+// unfortunately, an export of ".": "mk2" in package.json couldn't work
+export * from 'mk2';
\ No newline at end of file

MODIFY
packages/compartment-mapper/test/fixtures-retained/node_modules/mk1/package.json
packages/compartment-mapper/test/fixtures-retained/node_modules/mk1/package.json
"version": "1.0.0",
"type": "module",
"exports": {
- ".": "mk2"
+ ".": "./index.js"
},
"dependencies": {
"mk2": "^1.0.0"

fix(compartment-mapper): relativize all exports from package.json - undo the change allowing reexports of dependencies by just stating them in package.json "exports" field