How to use the babel-relay-plugin/lib/RelayQLTransformer 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
export function initTemplateStringTransformer(schemaJson) {
  const schema = getSchema(schemaJson);
  const transformer = new RelayQLTransformer(schema, {});

  function templateStringTag(quasis, ...expressions) {
    const processedTemplateLiteral = processTemplateLiteral(quasis, expressions, 'queryName');

    const processedTemplateText = transformer.processTemplateText(processedTemplateLiteral.templateText, {
      documentName: 'queryName',
      propName: 'propName'
    });

    const definition = transformer.processDocumentText(processedTemplateText, {
      documentName: 'queryName',
      propName: 'propName',
      fragmentLocationID: generateHash(JSON.stringify(processedTemplateText)).substring(0, 12)
    });

    const options = {};

babel-relay-plugin

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

MIT
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis

Similar packages