inferExportsAndAliases = (
  descriptor,
  externalAliases,
  internalAliases,
  conditions,
  types,
) => {
  const { name, type, main, module, exports, browser } = descriptor;

  // collect externalAliases from exports and main/module
  assign(
    externalAliases,
    fromEntries(inferExportsEntries(descriptor, conditions, types)),
  );

  // expose default module as package root
  // may be overwritten by browser field
  // see https://github.com/endojs/endo/issues/1363
  if (module === undefined && exports === undefined) {
    const defaultModule = main !== undefined ? relativize(main) : './index.js';
    externalAliases['.'] = defaultModule;
    // in commonjs, expose package root as default module
    if (type !== 'module') {
      internalAliases['.'] = defaultModule;
    }
  }

  // if present, allow "browser" field to populate moduleMap
  if (conditions.has('browser') && browser !== undefined) {
    for (const [specifier, target] of interpretBrowserField(
      name,
      browser,
      main,
    )) {
      const specifierIsRelative =
        specifier.startsWith('./') || specifier === '.';
      // only relative entries in browser field affect external aliases
      if (specifierIsRelative) {
        externalAliases[specifier] = target;
      }
      internalAliases[specifier] = target;
    }
  }
}
@param {PackageDescriptor} descriptor
@param {Node['externalAliases']} externalAliases
@param {Node['internalAliases']} internalAliases
@param {Set<string>} conditions
@param {Record<string, string>} types