def METHOD_NAME(ctx):
    proto = ctx.attr.proto
    arguments = []
    # create a list of well known proto files if the argument is non-None
    well_known_proto_files = []
    arguments.append("-Iexternal/com_google_protobuf/src")
    well_known_proto_files = [
        f
        for f in ctx.attr.well_known_protos.files.to_list()
    ]
    srcs = _generate_grpc_web_srcs(
        actions = ctx.actions,
        protoc = ctx.executable._protoc,
        protoc_gen_grpc_web = ctx.executable._protoc_gen_grpc_web,
        protoc_gen_js = ctx.executable._protoc_gen_js,
        mode = ctx.attr.mode,
        well_known_proto_files = well_known_proto_files,
        well_known_proto_arguments = arguments,
        sources = proto[ProtoInfo].direct_sources,
        transitive_sources = proto[ProtoInfo].transitive_imports,
        genGRPC = ctx.attr.grpc,
    )
    return [DefaultInfo(files = depset(srcs))]