static async getPathsFromExportMap(exports, { nodeResolveMode = 'default', packageRootPath }) {
    const exportMapPaths = [];

    for (const [key, valObjOrStr] of Object.entries(exports)) {
      let resolvedKey = key;
      let resolvedVal = getStringOrObjectValOfExportMapEntry({ valObjOrStr, nodeResolveMode });
      if (resolvedVal === null) {
        // eslint-disable-next-line no-continue
        continue;
      }

      // Allow older specs like "./__element-definitions/" : "./__element-definitions/" to also work,
      // so we normalize them to the new spec
      if (resolvedVal.endsWith?.('/') && resolvedKey.endsWith('/')) {
        resolvedVal += '*';
        resolvedKey += '*';
      }

      if (!resolvedKey.includes('*')) {
        exportMapPaths.push({
          internal: resolvedVal,
          exposed: resolvedKey,
        });
        // eslint-disable-next-line no-continue
        continue;
      }

      // https://nodejs.org/api/packages.html#subpath-exports
      const valueToUseForGlob = stripDotSlashFromLocalPath(resolvedVal).replace('*', '**/*');

      // Generate all possible entries via glob, first strip './'
      const internalExportMapPathsForKeyRaw = await globby(valueToUseForGlob, {
        cwd: packageRootPath,
        onlyFiles: true,
      });

      const exposedExportMapPathsForKeyRaw = internalExportMapPathsForKeyRaw.map(pathInside => {
        // Say we have "exports": { "./*.js": "./src/*.js" }
        // => internalExportMapPathsForKey: ['./src/a.js', './src/b.js']
        // => exposedExportMapPathsForKey: ['./a.js', './b.js']
        const [, variablePart] =
          pathInside.match(new RegExp(valueToUseForGlob.replace('*', '(.*)'))) || [];
        return resolvedKey.replace('*', variablePart);
      });
      const internalExportMapPathsForKey = internalExportMapPathsForKeyRaw.map(
        normalizeLocalPathWithDotSlash,
      );
      const exposedExportMapPathsForKey = exposedExportMapPathsForKeyRaw.map(
        normalizeLocalPathWithDotSlash,
      );

      exportMapPaths.push(
        ...internalExportMapPathsForKey.map((internal, idx) => ({
          internal,
          exposed: exposedExportMapPathsForKey[idx],
        })),
      );
    }

    return exportMapPaths;
  }
@param {{[key:string]: string|object|null}} exports
@param {object} opts
@param {'default'|'development'|string} [opts.nodeResolveMode='default']
@param {string} opts.packageRootPath
@returns {Promise<{internal:string; exposed:string}[]>}