@0no-co/graphql.web 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/graphql.web.d.ts +4 -1
- package/dist/graphql.web.js +212 -140
- package/dist/graphql.web.js.map +1 -1
- package/dist/graphql.web.mjs +230 -160
- package/dist/graphql.web.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
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
|
|
20
|
+
absolute minimum of features and exports of `graphql` utilities that typical
|
|
21
|
+
GraphQL web apps or GraphQL clients need.
|
|
22
|
+
|
|
23
|
+
While its goal isn’t to be an exact match to [the GraphQL.js
|
|
24
|
+
API](https://graphql.org/graphql-js/graphql/) it aims to provide API- and
|
|
25
|
+
type-compatible where possible and necessary. However, its goal is to provide
|
|
26
|
+
the smallest implementation for common GraphQL utilities that are still either
|
|
27
|
+
spec-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
|
+
|
|
36
|
+
Currently, only a select few exports are provided — namely, the ones listed here
|
|
37
|
+
are used in `@urql/core`, and we expect them to be common in all client-side
|
|
38
|
+
GraphQL 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
|
+
|
|
49
|
+
The stated goals of any reimplementation are:
|
|
50
|
+
1. Not to implement any execution or type system parts of the GraphQL
|
|
51
|
+
specification.
|
|
52
|
+
2. To adhere to GraphQL.js’ types and APIs as much as possible.
|
|
53
|
+
3. Not to implement or expose any rarely used APIs or properties of the
|
|
54
|
+
GraphQL.js library.
|
|
55
|
+
4. To provide a minimal and maintainable subset of GraphQL.js utilities.
|
|
56
|
+
|
|
57
|
+
Therefore, while we can foresee implementing APIs that are entirely separate and
|
|
58
|
+
unrelated to the GraphQL.js library in the future, for now the stated goals are
|
|
59
|
+
designed to allow this library to be used by GraphQL clients, like
|
|
60
|
+
[`@urql/core`](https://github.com/urql-graphql/urql).
|
package/dist/graphql.web.d.ts
CHANGED
|
@@ -247,4 +247,7 @@ declare function printString(string: string): string;
|
|
|
247
247
|
declare function printBlockString(string: string): string;
|
|
248
248
|
declare function print(node: ASTNode): string;
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
declare function valueFromASTUntyped(node: ValueNode, variables?: Maybe<Record<string, any>>): unknown;
|
|
251
|
+
declare function valueFromTypeNode(node: ValueNode, type: TypeNode, variables?: Maybe<Record<string, any>>): unknown;
|
|
252
|
+
|
|
253
|
+
export { ASTNode, ASTReducer, ASTVisitFn, ASTVisitor, ArgumentNode, BREAK, BooleanValueNode, ConstArgumentNode, ConstDirectiveNode, ConstListValueNode, ConstObjectFieldNode, ConstObjectValueNode, ConstValueNode, DefinitionNode, DirectiveNode, DocumentNode, EnumValueNode, ExecutableDefinitionNode, FieldNode, FloatValueNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLError, InlineFragmentNode, IntValueNode, Kind, ListTypeNode, ListValueNode, Location, NameNode, NamedTypeNode, NonNullTypeNode, NullValueNode, ObjectFieldNode, ObjectValueNode, OperationDefinitionNode, OperationTypeNode, SelectionNode, SelectionSetNode, Source, StringValueNode, TypeNode, ValueNode, VariableDefinitionNode, VariableNode, blockString, parse, parseType, parseValue, print, printBlockString, printString, valueFromASTUntyped, valueFromTypeNode, visit };
|