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

Compare changes

Choose any two refs to compare.

Changed files
+68 -27
.github
scripts
rollup
-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
+10
CHANGELOG.md
···
`MAJOR.MINOR.PATCH` version of the aliased `graphql` version on `npm`.
The prerelease is incremented to indicate changes in `graphql-web-lite`.
+
## 16.6.0-4
+
+
- Move `@0no-co/graphql.web` to dependencies and externalize it in the output
+
dist files.
+
- Upgrade to `@0no-co/graphql.web@^1.0.0`
+
+
## 16.6.0-3
+
+
- Fix incorrect `package.json:engines.node` entry.
+
## 16.6.0-2
- Replace `utilities/findBreakingChanges` with no-op code.
+13 -16
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
···
```diff
{
"dependencies": {
-
- "graphql": "^15.5.0"
-
+ "graphql": "npm:graphql-web-lite@^15.5.1001"
+
- "graphql": "^16.6.0"
+
+ "graphql": "npm:graphql-web-lite@^16.6.0-3"
}
}
```
···
### 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`.
+5 -3
package.json
···
{
"name": "graphql-web-lite",
"description": "graphql npm package slimmed down for client-side libraries",
-
"version": "16.6.0-1",
+
"version": "16.6.0-4",
"license": "MIT",
"scripts": {
"prepare": "node ./scripts/prepare.js",
···
"types": "index.d.ts",
"sideEffects": false,
"engines": {
-
"node": "^16.19.0 || ^18.14.0 || >=19.7.0"
+
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
},
"files": [
"README.md",
···
"graphql": "~16.6.0"
}
},
+
"dependencies": {
+
"@0no-co/graphql.web": "^1.0.0"
+
},
"devDependencies": {
-
"@0no-co/graphql.web": "^0.1.6",
"@babel/core": "^7.21.3",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.0.1",
+13 -5
pnpm-lock.yaml
···
.:
specifiers:
-
'@0no-co/graphql.web': ^0.1.6
+
'@0no-co/graphql.web': ^1.0.0
'@babel/core': ^7.21.3
'@rollup/plugin-babel': ^6.0.3
'@rollup/plugin-node-resolve': ^15.0.1
···
sucrase: ^3.30.0
typescript: ^5.0.2
vitest: ^0.29.7
+
dependencies:
+
'@0no-co/graphql.web': 1.0.0_graphql@16.6.0
devDependencies:
-
'@0no-co/graphql.web': 0.1.6
'@babel/core': 7.21.3
'@rollup/plugin-babel': 6.0.3_a7epsyulyww3x7faazdjx6zxy4
'@rollup/plugin-node-resolve': 15.0.1_rollup@3.20.1
···
packages:
-
/@0no-co/graphql.web/0.1.6:
-
resolution: {integrity: sha512-HUFsLTSjX6sTdK+CyoHNs71h0HneugTO6nQS8WwxFGarmAh3doKwZRVY39xLkdOmneSKJZIHRysjf+odHHBFhw==}
-
dev: true
+
/@0no-co/graphql.web/1.0.0_graphql@16.6.0:
+
resolution: {integrity: sha512-JBq2pWyDchE1vVjj/+c4dzZ8stbpew4RrzpZ3vYdn1WJFGHfYg6YIX1fDdMKtSXJJM9FUlsoDOxemr9WMM2p+A==}
+
peerDependencies:
+
graphql: '*'
+
peerDependenciesMeta:
+
graphql:
+
optional: true
+
dependencies:
+
graphql: 16.6.0
+
dev: false
/@ampproject/remapping/2.2.0:
resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}
+1 -1
scripts/rollup/config.mjs
···
const aliasModule = path.posix.join(cwd, 'alias/');
const EXTERNAL = 'graphql';
-
const externalModules = ['dns', 'fs', 'path', 'url'];
+
const externalModules = ['dns', 'fs', 'path', 'url', '@0no-co/graphql.web'];
const externalPredicate = new RegExp(`^(${externalModules.join('|')})($|/)`);
function manualChunks(id, utils) {