async function parseForPolicy({
  projectRoot,
  entryId,
  policyOverride = {},
  rootPackageName,
  shouldResolve,
  includeDebugInfo,
  ...args
}) {
  const isBuiltin = (id) => builtinPackages.includes(id)
  const { resolutions } = policyOverride
  const canonicalNameMap = await loadCanonicalNameMap({
    rootDir: projectRoot,
    includeDevDeps: true,
  })
  const resolveHook = makeResolveHook({
    projectRoot,
    resolutions,
    rootPackageName,
    canonicalNameMap,
  })
  const importHook = makeImportHook({
    rootPackageName,
    shouldResolve,
    isBuiltin,
    resolveHook,
    canonicalNameMap,
    policyOverride,
  })
  const moduleSpecifier = resolveHook(
    entryId,
    path.join(projectRoot, 'package.json')
  )
  const inspector = createModuleInspector({ isBuiltin, includeDebugInfo })
  // rich warning output
  inspector.on('compat-warning', displayRichCompatWarning)
  return coreParseForConfig({
    moduleSpecifier,
    importHook,
    isBuiltin,
    inspector,
    policyOverride,
    ...args,
  })
}
@param {ParseForPolicyOpts} opts
@returns {Promise<import('lavamoat-core').LavaMoatPolicy>}