How to use the babel-relay-plugin function in babel-relay-plugin

To help you get started, we’ve selected a few babel-relay-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / relay / website-prototyping-tools / RelayPlayground.js View on Github external
graphql(Schema, introspectionQuery).then((result) => {
      if (
        this.state.schemaSource !== schemaSource ||
        this.state.appSource !== appSource
      ) {
        // This version of the code is stale. Bail out.
        return;
      }
      this._babelRelayPlugin = getBabelRelayPlugin(result.data);
      Relay.injectNetworkLayer(
        new RelayLocalSchema.NetworkLayer({
          schema: Schema,
          onError: (errors, request) => {
            this.setState({
              error: errorFromGraphQLResultAndQuery(errors, request),
              errorType: ERROR_TYPES.query,
            });
          },
        })
      );
      this._updateApp(appSource);
    });
  }
github prisma-archive / babel-plugin-react-relay / src / index.js View on Github external
})

  // TODO find a cleaner way to do this
  loopWhile(() => wait)

  // this error could happen while downloading the schema
  if (error) {
    throw error
  }

  if (schema.errors) {
    throw new Error(JSON.stringify(schema.errors))
  }

  if (schema.data) {
    return getBabelRelayPlugin(schema.data)(babel)
  } else {
    return {
      visitor: {}
    }
  }
}
github grahammendick / navigation / NavigationReact / sample / relay / babelRelayPlugin.js View on Github external
import getbabelRelayPlugin from 'babel-relay-plugin';
import schema from './schema.json';

module.exports = getbabelRelayPlugin(schema.data);
github guymers / babel-plugin-flow-relay-query / src / index.js View on Github external
function createPlugin(
  schemaProvider: GraphQLSchemaProvider,
  babelpluginOptions: Object = {},
  pluginOptions: Object = {}
): Function {
  const babelRelayPlugin = getBabelRelayPlugin(schemaProvider, babelpluginOptions);

  const schema = createSchema(schemaProvider);
  const flowRelayQueryPlugin = createFlowRelayQueryPlugin(schema, pluginOptions);

  return function plugin(babel) {
    return {
      inherits: babelRelayPlugin(babel),
      ...flowRelayQueryPlugin(babel)
    };
  };
}
github MattMcFarland / reactathon / scripts / babelRelayPlugin.js View on Github external
import getBabelRelayPlugin from 'babel-relay-plugin';

import schema from '../data/schema.json';

var plugin = getBabelRelayPlugin(schema);

return babel.transform(source)


export default getBabelRelayPlugin(schema.data);
github cdebotton / react-relay-redux / webpack / helpers / babelRelayTransformer.js View on Github external
import getBabelRelayPlugin from 'babel-relay-plugin';

let data;

try {
  ({data} = require('../../build/schema.json'));
} catch (ex) {
  data = {};
}

export default getBabelRelayPlugin(data);
github MattMcFarland / reactathon / scripts / babelRelayPlugin.js View on Github external
import getBabelRelayPlugin from 'babel-relay-plugin';

import schema from '../data/schema.json';

var plugin = getBabelRelayPlugin(schema);

return babel.transform(source)


export default getBabelRelayPlugin(schema.data);

babel-relay-plugin

Babel Relay Plugin for transpiling GraphQL queries for use with Relay.

MIT
Latest version published 7 years ago

Package Health Score

62 / 100
Full package analysis

Similar packages