How to use the apollo-codegen-core/lib/loading.extractDocumentFromJavascript function in apollo-codegen-core

To help you get started, we’ve selected a few apollo-codegen-core 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 apollographql / apollo-tooling / packages / apollo / src / fetch-schema.ts View on Github external
const schemaData = parsed.data
      ? parsed.data.__schema
      : parsed.__schema
        ? parsed.__schema
        : parsed;

    return schemaData;
  }

  if (ext === ".graphql" || ext === ".graphqls" || ext === ".gql") {
    return await buildIntrospectionSchemaFromSDL(new Source(result, file));
  }

  if (ext === ".ts" || ext === ".tsx" || ext === ".js" || ext === ".jsx") {
    return await buildIntrospectionSchemaFromSDL(
      extractDocumentFromJavascript(result)!
    );
  }

  return;
}