A lightweight, dependency-free GraphQL client for JavaScript (version 0.6.8, last updated in 2017). It supports both browser and Node.js environments, providing a simple API for executing queries and mutations with fragment management. Key differentiators: <4kB gzipped, zero dependencies, isomorphic, query merging, and no requirement for React or Relay. However, it is outdated and lacks TypeScript support, modern ESM, and subscription support. Development appears to be stagnant with no recent releases.
npm install graphql.jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows connection setup with token, fragment definition, and execution of both a mutation and a query.
Migrate to a maintained GraphQL client such as graphql-request.
Always call the prepared function: const result = await graph(query)(variables);
Use `@autodeclare` in mutation/query string or explicitly declare variables (e.g., `$email: String!`).
Manually check for errors in the response or use a try-catch around the call.
Use `import graphql from 'graphql.js'` or `const graphql = require('graphql.js')`.First call `graph(queryString)` to prepare a query, then call the returned function with variables: `const exec = graph('query...'); exec(variables)`.Check the GraphQL endpoint URL and ensure it returns valid JSON with `{ data: ... }`. Add error handling for network failures.No dependency data recorded yet.