Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
});
}
})
// 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: {}
}
}
}
import getbabelRelayPlugin from 'babel-relay-plugin';
import schema from './schema.json';
module.exports = getbabelRelayPlugin(schema.data);
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)
};
};
}
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);
import getBabelRelayPlugin from 'babel-relay-plugin';
let data;
try {
({data} = require('../../build/schema.json'));
} catch (ex) {
data = {};
}
export default getBabelRelayPlugin(data);
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);