How to use the babel-relay-plugin/lib/invariant 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 stubailo / relay-runtime-query / src / index.js View on Github external
quasis.forEach((chunk, ii) => {
    chunks.push(chunk);

    if (ii !== quasis.length - 1) {
      const name = 'RQL_' + ii;
      const value = expressions[ii];

      runtime.fragments[name] = value;

      substitutions.push({name, value});

      if (/:\s*$/.test(chunk)) {
        invariant(
          false, // this.options.substituteVariables,
          'You supplied a GraphQL document named `%s` that uses template ' +
          'substitution for an argument value, but variable substitution ' +
          'has not been enabled.',
          documentName
        );
        chunks.push('$' + name);
        variableNames[name] = undefined;
      } else {
        chunks.push('...' + name);
      }
    }
  });
github stubailo / relay-runtime-query / src / index.js View on Github external
function getSchema(schemaProvider: GraphQLSchemaProvider): GraphQLSchema {
  const introspection = typeof schemaProvider === 'function' ?
    schemaProvider() :
    schemaProvider;
  invariant(
    typeof introspection === 'object' && introspection &&
    typeof introspection.__schema === 'object' && introspection.__schema,
    'Invalid introspection data supplied to `getBabelRelayPlugin()`. The ' +
    'resulting schema is not an object with a `__schema` property.'
  );
  return buildClientSchema(introspection);
}

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