Socket
Socket
Sign inDemoInstall

@0no-co/graphql.web

Package Overview
Dependencies
1
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @0no-co/graphql.web

A spec-compliant client-side GraphQL implementation


Version published
Maintainers
1
Install size
149 kB
Created

Changelog

Source

1.0.0

Major Changes

  • Release stable v1.0.0 Release Submitted by @kitten (See ca082c8)

Minor Changes

  • Alias all GraphQL AST types to the 'graphql' package’s TypeScript AST types, if it’s installed. This will ensure that all AST types are always compatible. Submitted by undefined (See https://github.com/0no-co/graphql.web/pull/10)

Readme

Source

@0no-co/graphql.web

The spec-compliant minimum of client-side GraphQL.

CI Status Bundlesize Discord

@0no-co/graphql.web is an experimental library, aiming to provide an absolute minimum of features and exports of graphql utilities that typical GraphQL web apps or GraphQL clients need.

While its goal isn’t to be an exact match to the GraphQL.js API it aims to provide API- and type-compatible where possible and necessary. However, its goal is to provide the smallest implementation for common GraphQL utilities that are still either spec-compliant or compatible with GraphQL.js’ implementation.

Note: While this library can be used as a drop-in replacement for graphql in some cases, the graphql-web-lite project is maintained to be a full shim/alias for the graphql package.

Overview

@0no-co/graphql.web aims to provide a minimal set of exports to implement client-side GraphQL utilities, mostly including parsing, printing, and visiting the GraphQL AST, and the GraphQLError class.

Currently, graphql.web compresses to under 4kB and doesn’t regress on GraphQL.js’ performance when parsing, printing, or visiting the AST.

For all primary APIs we aim to hit 100% test coverage and match the output, types, and API compatibility of GraphQL.js, including — as far as possible — TypeScript type compatibility of the AST types with the currently stable version of GraphQL.js.

API

Currently, only a select few exports are provided — namely, the ones listed here are used in @urql/core, and we expect them to be common in all client-side GraphQL applications.

ExportDescriptionLinks
parseA tiny (but compliant) GraphQL query language parser.Source
printA (compliant) GraphQL query language printer.Source
visitA recursive reimplementation of GraphQL.js’ visitor.Source
KindThe GraphQL.js’ Kind enum, containing supported ASTNode kinds.Source
GraphQLErrorGraphQLError stripped of source/location debugging.Source
valueFromASTUntypedCoerces AST values into JS values.Source

The stated goals of any reimplementation are:

  1. Not to implement any execution or type system parts of the GraphQL specification.
  2. To adhere to GraphQL.js’ types and APIs as much as possible.
  3. Not to implement or expose any rarely used APIs or properties of the GraphQL.js library.
  4. To provide a minimal and maintainable subset of GraphQL.js utilities.

Therefore, while we can foresee implementing APIs that are entirely separate and unrelated to the GraphQL.js library in the future, for now the stated goals are designed to allow this library to be used by GraphQL clients, like @urql/core.

Keywords

FAQs

Last updated on 24 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc