loadCompartmentMap = async (
  entrypointPath,
  {
    readPowers = defaultReadPowers,
    policyOverride,
    trustRoot,
    log = defaultLog,
    compartmentDescriptorTransforms = [],
    dev,
    ...captureOpts
  } = {}
) => {
  // some packages use "node" as a condition (as opposed to "browser")
  const conditions = new Set(['node'])

  const entrypoint = toEndoURL(entrypointPath)

  const nodeCompartmentMap = await mapNodeModules(readPowers, entrypoint, {
    conditions,
    dev,
    languageForExtension: DEFAULT_ENDO_OPTIONS.languageForExtension,
  })

  compartmentDescriptorTransforms.push(finalCompartmentDescriptorTransform)

  values(nodeCompartmentMap.compartments).forEach((compartmentDescriptor) =>
    compartmentDescriptorTransforms.forEach((transform) =>
      transform(compartmentDescriptor, { trustRoot, log })
    )
  )

  // we use this to inject missing imports from policy overrides into the module descriptor.
  // TODO: Endo should allow us to hook into `importHook` directly instead
  const PolicyGenCompartment = makePolicyGenCompartment(
    nodeCompartmentMap,
    policyOverride
  )

  const {
    captureCompartmentMap: compartmentMap,
    captureSources: sources,
    newToOldCompartmentNames: renames,
  } = await captureFromMap(readPowers, nodeCompartmentMap, {
    ...DEFAULT_ENDO_OPTIONS,
    importHook: nullImportHook,
    Compartment: PolicyGenCompartment,
    ...captureOpts,
  })

  return {
    compartmentMap,
    sources,
    renames,
  }
}
Loads compartment map and associated sources.

This is _only_ for policy gen.

@param {string | URL} entrypointPath
@param {LoadCompartmentMapOptions} opts
@returns {Promise<LoadCompartmentMapResult>}
@internal