···11+---
22+'@0no-co/graphql.web': patch
33+---
44+55+Update build process to align with other `@0no-co` packages. Effectively, this will mean that the JS features range we support will now match `urql`, and in practice, this means that `for-of` is now used in our build output.
+3
.github/workflows/ci.yml
···5353 - name: Unit Tests
5454 run: pnpm run test --run
55555656+ - name: benchmarks
5757+ run: pnpm run bench --run
5858+5659 - name: Build
5760 run: pnpm run build
+9-8
README.md
···5555are used in `@urql/core`, and we expect them to be common in all client-side
5656GraphQL applications.
57575858-| Export | Description | Links |
5959-| --- | ----------- | -------- |
6060-| `parse` | A tiny (but compliant) GraphQL query language parser. | [Source](./src/parser.ts) |
6161-| `print` | A (compliant) GraphQL query language printer. | [Source](./src/printer.ts) |
6262-| `visit` | A recursive reimplementation of GraphQL.js’ visitor. | [Source](./src/printer.ts) |
6363-| `Kind` | The GraphQL.js’ `Kind` enum, containing supported `ASTNode` kinds. | [Source](./src/kind.ts) |
6464-| `GraphQLError` | `GraphQLError` stripped of source/location debugging. | [Source](./src/kind.ts) |
6565-| `valueFromASTUntyped` | Coerces AST values into JS values. | [Source](./src/values.ts) |
5858+| Export | Description | Links |
5959+| --------------------- | ------------------------------------------------------------------ | -------------------------- |
6060+| `parse` | A tiny (but compliant) GraphQL query language parser. | [Source](./src/parser.ts) |
6161+| `print` | A (compliant) GraphQL query language printer. | [Source](./src/printer.ts) |
6262+| `visit` | A recursive reimplementation of GraphQL.js’ visitor. | [Source](./src/printer.ts) |
6363+| `Kind` | The GraphQL.js’ `Kind` enum, containing supported `ASTNode` kinds. | [Source](./src/kind.ts) |
6464+| `GraphQLError` | `GraphQLError` stripped of source/location debugging. | [Source](./src/kind.ts) |
6565+| `valueFromASTUntyped` | Coerces AST values into JS values. | [Source](./src/values.ts) |
66666767The stated goals of any reimplementation are:
6868+68691. Not to implement any execution or type system parts of the GraphQL
6970 specification.
70712. To adhere to GraphQL.js’ types and APIs as much as possible.
-69
benchmark/kitchen_sink.graphql
···11-# Copyright (c) 2015-present, Facebook, Inc.
22-#
33-# This source code is licensed under the MIT license found in the
44-# LICENSE file in the root directory of this source tree.
55-66-query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery {
77- whoever123is: node(id: [123, 456]) {
88- id
99- ... on User @onInlineFragment {
1010- field2 {
1111- id
1212- alias: field1(first: 10, after: $foo) @include(if: $foo) {
1313- id
1414- ...frag @onFragmentSpread
1515- }
1616- }
1717- }
1818- ... @skip(unless: $foo) {
1919- id
2020- }
2121- ... {
2222- id
2323- }
2424- }
2525-}
2626-2727-mutation likeStory @onMutation {
2828- like(story: 123) @onField {
2929- story {
3030- id @onField
3131- }
3232- }
3333-}
3434-3535-subscription StoryLikeSubscription($input: StoryLikeSubscribeInput)
3636-@onSubscription {
3737- storyLikeSubscribe(input: $input) {
3838- story {
3939- likers {
4040- count
4141- }
4242- likeSentence {
4343- text
4444- }
4545- }
4646- }
4747-}
4848-4949-fragment frag on Friend @onFragmentDefinition {
5050- foo(
5151- size: $site
5252- bar: 12
5353- obj: {
5454- key: "value"
5555- block: """
5656- block string uses \"""
5757- """
5858- }
5959- )
6060-}
6161-6262-query teeny {
6363- unnamed(truthy: true, falsey: false, nullish: null)
6464- query
6565-}
6666-6767-query tiny {
6868- __typename
6969-}
···11-import { Maybe, Extensions, Source } from './types';
22-import { ASTNode } from './ast';
11+import type { Maybe, Extensions, Source } from './types';
22+import type { ASTNode } from './ast';
3344export class GraphQLError extends Error {
55 readonly locations: ReadonlyArray<any> | undefined;
+2-2
src/parser.ts
···44 * in graphql.js it will only parse the query language, but not the schema
55 * language.
66 */
77-import { Kind, OperationTypeNode } from './kind';
77+import type { Kind, OperationTypeNode } from './kind';
88import { GraphQLError } from './error';
99-import { Source } from './types';
99+import type { Source } from './types';
1010import type * as ast from './ast';
11111212let input: string;
+1-1
src/printer.ts
···11-import { ASTNode } from './ast';
11+import type { ASTNode } from './ast';
2233export function printString(string: string) {
44 return JSON.stringify(string);
+2-2
src/values.ts
···11-import { TypeNode, ValueNode } from './ast';
22-import { Maybe } from './types';
11+import type { TypeNode, ValueNode } from './ast';
22+import type { Maybe } from './types';
3344export function valueFromASTUntyped(
55 node: ValueNode,
+3-3
src/visitor.ts
···11-import { ASTNode } from './ast';
11+import type { ASTNode } from './ast';
2233export const BREAK = {};
44···131131type ReducedField<T, R> = T extends null | undefined
132132 ? T
133133 : T extends ReadonlyArray<any>
134134- ? ReadonlyArray<R>
135135- : R;
134134+ ? ReadonlyArray<R>
135135+ : R;
-18
typings/document.ts
···11-import type * as graphql from 'graphql';
22-import type * as graphqlWeb from '../src/index';
33-44-export function documentInput(input: graphqlWeb.DocumentNode): graphql.DocumentNode {
55- return input;
66-}
77-88-export function documentOutput(input: graphql.DocumentNode): graphqlWeb.DocumentNode {
99- return input;
1010-}
1111-1212-export function nodeInput(input: graphqlWeb.ASTNode): graphql.ASTNode {
1313- return input;
1414-}
1515-1616-export function nodeOutput(input: graphql.ASTNode): graphqlWeb.ASTNode {
1717- return input;
1818-}
-10
typings/error.ts
···11-import type * as graphql from 'graphql';
22-import type * as graphqlWeb from '../src/index';
33-44-export function errorInput(input: graphqlWeb.GraphQLError): graphql.GraphQLError {
55- return input;
66-}
77-88-export function errorOutput(input: graphql.GraphQLError): graphqlWeb.GraphQLError {
99- return input;
1010-}
-18
typings/parser.ts
···11-import type * as graphql from 'graphql';
22-import type * as graphqlWeb from '../src/index';
33-44-export function parseInput(input: typeof graphqlWeb.parse): typeof graphql.parse {
55- return input;
66-}
77-88-export function parseOutput(input: typeof graphql.parse): typeof graphqlWeb.parse {
99- return input;
1010-}
1111-1212-export function parseValueInput(input: typeof graphqlWeb.parseValue): typeof graphql.parseValue {
1313- return input;
1414-}
1515-1616-export function parseValueOutput(input: typeof graphql.parseValue): typeof graphqlWeb.parseValue {
1717- return input;
1818-}
-10
typings/visitor.ts
···11-import type * as graphql from 'graphql';
22-import type * as graphqlWeb from '../src/index';
33-44-export function visitInput(input: typeof graphqlWeb.visit): typeof graphql.visit {
55- return input;
66-}
77-88-export function visitOutput(input: typeof graphql.visit): typeof graphqlWeb.visit {
99- return input;
1010-}