async def METHOD_NAME(
    console: Console,
    targets: FilteredTargets,
    workspace: Workspace,
    union_membership: UnionMembership,
    build_root: BuildRoot,
    dist_dir: DistDir,
    export_subsys: ExportSubsystem,
) -> Export:
    request_types = cast("Iterable[type[ExportRequest]]", union_membership.get(ExportRequest))
    requests = tuple(request_type(targets) for request_type in request_types)
    all_results = await MultiGet(Get(ExportResults, ExportRequest, request) for request in requests)
    flattened_results = [res for results in all_results for res in results]
    await _warn_on_non_local_environments(targets, "the `export` goal")
    prefixed_digests = await MultiGet(
        Get(Digest, AddPrefix(result.digest, result.reldir)) for result in flattened_results
    )
    output_dir = os.path.join(str(dist_dir.relpath), "export")
    for result in flattened_results:
        digest_root = os.path.join(build_root.path, output_dir, result.reldir)
        safe_rmtree(digest_root)
    merged_digest = await Get(Digest, MergeDigests(prefixed_digests))
    dist_digest = await Get(Digest, AddPrefix(merged_digest, output_dir))
    workspace.write_digest(dist_digest)
    environment = await Get(EnvironmentVars, EnvironmentVarsRequest(["PATH"]))
    resolves_exported = set()
    for result in flattened_results:
        result_dir = os.path.join(output_dir, result.reldir)
        digest_root = os.path.join(build_root.path, result_dir)
        for cmd in result.post_processing_cmds:
            argv = tuple(arg.format(digest_root=digest_root) for arg in cmd.argv)
            ip = InteractiveProcess(
                argv=argv,
                env={"PATH": environment.get("PATH", ""), **cmd.extra_env},
                run_in_workspace=True,
            )
            ipr = await Effect(InteractiveProcessResult, InteractiveProcess, ip)
            if ipr.exit_code:
                raise ExportError(f"Failed to write {result.description} to {result_dir}")
        if result.resolve:
            resolves_exported.add(result.resolve)
        console.print_stdout(f"Wrote {result.description} to {result_dir}")
    unexported_resolves = sorted((set(export_subsys.resolve) - resolves_exported))
    if unexported_resolves:
        all_known_user_resolve_names = await MultiGet(
            Get(KnownUserResolveNames, KnownUserResolveNamesRequest, request())
            for request in union_membership.get(KnownUserResolveNamesRequest)
        )
        all_valid_resolve_names = sorted(
            {
                *itertools.chain.from_iterable(kurn.names for kurn in all_known_user_resolve_names),
                *(
                    sentinel.resolve_name
                    for sentinel in union_membership.get(GenerateToolLockfileSentinel)
                ),
            }
        )
        raise UnrecognizedResolveNamesError(
            unexported_resolves,
            all_valid_resolve_names,
            description_of_origin="the option --export-resolve",
        )
    return Export(exit_code=0)