index.js
function initBabelRelayPlugin(pluginOptions, babel, ref) {
  const verbose = !!pluginOptions.verbose;
  const schemaFilepath = pluginOptions.schema || '';
  let schema;

  try {
    schema = fs.readFileSync(schemaFilepath, 'utf8');
  } catch (e) {
    schema = null;
    log('Cannot load GraphQL Schema from file \''
                 + schemaFilepath + '\': ' + e);
  }

  if (schema) {
    if (verbose) {
      log('GraphQL Schema loaded successfully from \'' + schemaFilepath + '\'');
    }
    ref.babelRelayPlugin = require('babel-plugin-relay')(babel);
  } else {
    // empty Plugin
    log('Relay.QL will not be transformed, cause `schema.data` is empty.');
    ref.babelRelayPlugin = {
      visitor: {
        Program: function () {},
        TaggedTemplateExpression: function () {},
      },
    };
  }
}
function initBabelRelayPlugin(pluginOptions, babel, ref) {
  const verbose = !!pluginOptions.verbose;
  const schemaFilepath = pluginOptions.schema || '';
  let schema;

  try {
    schema = fs.readFileSync(schemaFilepath, 'utf8');
  } catch (e) {
    schema = null;
    log('Cannot load GraphQL Schema from file \''
                 + schemaFilepath + '\': ' + e);
  }

  if (schema) {
    if (verbose) {
      log('GraphQL Schema loaded successfully from \'' + schemaFilepath + '\'');
    }
    ref.babelRelayPlugin = require('babel-plugin-relay')(babel);
  } else {
    // empty Plugin
    log('Relay.QL will not be transformed, cause `schema.data` is empty.');
    ref.babelRelayPlugin = {
      visitor: {
        Program: function () {},
        TaggedTemplateExpression: function () {},
      },
    };
  }
}
babelRelayPlugin initializer