Mirror: The small sibling of the graphql package, slimmed down for client-side libraries.

Compare changes

Choose any two refs to compare.

Changed files
+37 -16
.github
-2
.github/FUNDING.yml
···
-
github: urql-graphql
-
open_collective: urql-graphql
+26
.github/workflows/mirror.yml
···
+
# Mirrors to https://tangled.sh/@kitten.sh (knot.kitten.sh)
+
name: Mirror (Git Backup)
+
on:
+
push:
+
branches:
+
- main
+
jobs:
+
mirror:
+
runs-on: ubuntu-latest
+
steps:
+
- name: Checkout repository
+
uses: actions/checkout@v4
+
with:
+
fetch-depth: 0
+
fetch-tags: true
+
- name: Mirror
+
env:
+
MIRROR_SSH_KEY: ${{ secrets.MIRROR_SSH_KEY }}
+
GIT_SSH_COMMAND: 'ssh -o StrictHostKeyChecking=yes'
+
run: |
+
mkdir -p ~/.ssh
+
echo "$MIRROR_SSH_KEY" > ~/.ssh/id_rsa
+
chmod 600 ~/.ssh/id_rsa
+
ssh-keyscan -H knot.kitten.sh >> ~/.ssh/known_hosts
+
git remote add mirror "git@knot.kitten.sh:kitten.sh/${GITHUB_REPOSITORY#*/}"
+
git push --mirror mirror
+11 -14
README.md
···
parser, printer, and visitor, which only support the GraphQL query language and
are tested to 100% coverage and built to match GraphQL.js’ performance.
+
In an average app using the GraphQL library for a GraphQL client aliasing this
+
package could save you 7kB gzip effortlessly.
+
+
> **Note:** If you’re using `@urql/core@^4` you’re already benefitting from
+
> `@0no-co/graphql.web`’s size reduction and aliasing `graphql-web-lite` will
+
> only benefit you if you import from `graphql` in any of your other code or
+
> libraries.
+
## Installation
`graphql-web-lite` mirrors the folder structure of the regular `graphql` package and
···
### Bundlesize Impact
Most GraphQL client-side libraries use the following common set of imports from the `graphql` library.
-
Assuming a transformation like [`babel-plugin-modular-graphql`](https://github.com/kitten/babel-plugin-modular-graphql/)
-
or granular imports in general this creates a short list of utilities.
```js
-
export { valueFromASTUntyped } from 'graphql/utilities/valueFromASTUntyped.mjs';
-
export { GraphQLError } from 'graphql/error/GraphQLError.mjs';
-
export { Kind } from 'graphql/language/kinds.mjs';
-
export { parse } from 'graphql/language/parser.mjs';
-
export { print } from 'graphql/language/printer.mjs';
-
export { visit } from 'graphql/language/visitor.mjs';
+
export { BREAK, isSelectionNode, parse, print, GraphQLError, Kind, visit } from 'graphql';
```
-
The minzipped size of the imports is about `11.2kB` in a given output bundle, which assumes all the above imports are
-
in use. When the GraphQL language parser is dropped from the bundle, for instance by precompiling queries and excluding
-
it in a compilation step, the resulting minzipped size drops to `5.55kB`.
-
-
When `graphql-web-lite` replaces the `graphql` package the minzipped size drops from the `11.2kB` figure down to `5.44kB`,
-
and `3.19kB` without the parser.
+
The minzipped size of the imports is about `10kB` in a given output bundle, which assumes all the above imports are
+
in use. When `graphql-web-lite` replaces the `graphql` package the minzipped size drops to about `3kB`.