Mirror: The spec-compliant minimum of client-side GraphQL.
1<div align="center">
2 <h2>@0no-co/graphql.web</h2>
3 <strong>The spec-compliant minimum of client-side GraphQL.</strong>
4 <br />
5 <br />
6 <a href="https://github.com/0no-co/graphql.web/actions/workflows/release.yml">
7 <img alt="CI Status" src="https://github.com/0no-co/graphql.web/actions/workflows/release.yml/badge.svg?branch=main" />
8 </a>
9 <a href="https://npmjs.com/package/@0no-co/graphql.web">
10 <img alt="Bundlesize" src="https://deno.bundlejs.com/?q=@0no-co/graphql.web&badge" />
11 </a>
12 <a href="https://urql.dev/discord">
13 <img alt="Discord" src="https://img.shields.io/discord/1082378892523864074?color=7389D8&label&logo=discord&logoColor=ffffff" />
14 </a>
15 <br />
16 <br />
17</div>
18
19`@0no-co/graphql.web` is an **experimental** library, aiming to provide an
20absolute minimum of features and exports of `graphql` utilities that typical
21GraphQL web apps or GraphQL clients need.
22
23While its goal isn’t to be an exact match to [the GraphQL.js
24API](https://graphql.org/graphql-js/graphql/) it aims to provide API- and
25type-compatible where possible and necessary. However, its goal is to provide
26the smallest implementation for common GraphQL utilities that are still either
27spec-compliant or compatible with GraphQL.js’ implementation.
28
29> **Note:** While this library can be used as a drop-in replacement for
30> `graphql` in _some cases_, the [`graphql-web-lite`
31> project](https://github.com/0no-co/graphql-web-lite) is maintained to be
32> a full shim/alias for the `graphql` package.
33
34### API
35
36Currently, only a select few exports are provided — namely, the ones listed here
37are used in `@urql/core`, and we expect them to be common in all client-side
38GraphQL applications.
39
40| Export | Description | Links |
41| --- | ----------- | -------- |
42| `parse` | A tiny (but compliant) GraphQL query language parser. | [Source](./src/parser.ts) |
43| `print` | A (compliant) GraphQL query language printer. | [Source](./src/printer.ts) |
44| `visit` | A recursive reimplementation of GraphQL.js’ visitor. | [Source](./src/printer.ts) |
45| `Kind` | The GraphQL.js’ `Kind` enum, containing supported `ASTNode` kinds. | [Source](./src/kind.ts) |
46| `GraphQLError` | `GraphQLError` stripped of source/location debugging. | [Source](./src/kind.ts) |
47| `valueFromASTUntyped` | Coerces AST values into JS values. | [Source](./src/values.ts) |
48
49The stated goals of any reimplementation are:
501. Not to implement any execution or type system parts of the GraphQL
51 specification.
522. To adhere to GraphQL.js’ types and APIs as much as possible.
533. Not to implement or expose any rarely used APIs or properties of the
54 GraphQL.js library.
554. To provide a minimal and maintainable subset of GraphQL.js utilities.
56
57Therefore, while we can foresee implementing APIs that are entirely separate and
58unrelated to the GraphQL.js library in the future, for now the stated goals are
59designed to allow this library to be used by GraphQL clients, like
60[`@urql/core`](https://github.com/urql-graphql/urql).