function reduceExportsLikeMap(
  exportsLikeMap: NormalizedExportsLikeMap,
  conditionNames: $ReadOnlySet<string>,
  createConfigError: (reason: string) => Error,
): FlattenedExportMap {
  const result = new Map<string, string | null>();

  for (const [subpath, value] of exportsLikeMap) {
    const subpathValue = reduceConditionalExport(value, conditionNames);

    // If a subpath has no resolution for the passed `conditionNames`, do not
    // include it in the result. (This includes only explicit `null` values,
    // which may conditionally hide higher-specificity subpath patterns.)
    if (subpathValue !== 'no-match') {
      result.set(subpath, subpathValue);
    }
  }

  for (const value of result.values()) {
    if (value != null && !value.startsWith('./')) {
      throw createConfigError(
        'One or more mappings for subpaths defined in "exports" are invalid. ' +
          'All values must begin with "./".',
      );
    }
  }
Reduce an "exports"-like mapping to a flat subpath mapping after resolving
conditional exports.