code: function buildRefetchMap(
    context: GraphQLCompilerContext,
  ): Map<string, Fragment> {
    const refetchOperations = new Map();
    const errors = eachWithErrors(context.documents(), node => {
      if (node.kind !== 'Fragment') {
        return;
      }
      const refetchName = getRefetchQueryName(node);
      if (refetchName === null) {
        return;
      }
      const previousOperation = refetchOperations.get(refetchName);
      if (previousOperation != null) {
        throw createUserError(
          `Duplicate definition for @refetchable operation '${refetchName}' from fragments '${
            node.name
          }' and '${previousOperation.name}'`,
          [node.loc, previousOperation.loc],
        );
      }
      refetchOperations.set(refetchName, node);
    });
    if (errors != null && errors.length !== 0) {
      throw createCombinedError(errors, 'RelayRefetchableFragmentTransform');
    }
    const transformed = inferRootArgumentDefinitions(context);
    return new Map(
      Array.from(refetchOperations.entries(), ([name, fragment]) => {
        return [name, transformed.getFragment(fragment.name)];
      }),
    );
  }
docs: Walk the documents of a compiler context and create a mapping of
  refetch operation names to the source fragment from which the refetch
  operation should be derived.