npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

graphql-ppx-fragments

v1.0.22

Published

graphql-ppx rewriter for ReScript/ReasonML

Downloads

4

Readme

Documentation

Go to the official documentation

Features

  • Language level GraphQL primitives

  • Building block for GraphQL clients

  • 100% type safe

Installation

Schema

graphql-ppx needs your graphql schema to be available in the form of a graphql_schema.json file.

The easiest way to add this to your project is using an introspection query to your backend. You can do this using get-graphql-schema:

npx get-graphql-schema ENDPOINT_URL -j > graphql_schema.json

With ENDPOINT_URL being the URL of your GraphQL endpoint.

Cache

graphql-ppx will generate a .graphql_ppx_cache folder alongside your JSON schema to optimize parsing performance. If you're using a version control system, you don't need to check it in.

The next pages will provide further installation instructions whether you are using graphql-ppx with Bucklescript or using Reason Native.

Bucklescript

First, add it to you dependencies using npm or yarn:

yarn add @reasonml-community/graphql-ppx --dev
# or
npm install @reasonml-community/graphql-ppx  --saveDev

Second, add it to ppx-flags and bs-dependencies in your bsconfig.json:

"ppx-flags": ["@reasonml-community/graphql-ppx/ppx"],
"bs-dependencies": ["@reasonml-community/graphql-ppx"]

Native

Caution!

The Bucklescript version of graphql-ppx was almost completely rewritten for the 1.0 release, with many improvements and changes. This documentation will focus on the API of the bucklescript version. This means that most of the examples won't apply for the Reason Native version. Please take a look at the old documentation. At the same time we welcome contributions to modernize the Reason Native version of graphql-ppx :::

You need to provide the following dependency in your esy.json file

{
  "dependencies": {
    "graphql-ppx": "*"
  },
  "resolutions": {
    "graphql-ppx": "reasonml-community/graphql-ppx:esy.json#<use latest stable commit from master>"
  }
}

and update your dune file:

(preprocess (pps graphql_ppx))

Usage

Make your first query:

Reason

[%graphql {|
  query UserQuery {
    user {
      id
      name
    }
  }
|}];

ReScript

%graphql(`
  query UserQuery {
    user {
      id
      name
    }
  }
`)

Open getting started in the docs

Roadmap

See our development board for a list of selected features and issues.

Contributing

We'd love your help improving graphql-ppx!

Take a look at our Contributing Guide to get started.

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

Thanks to everyone who contributed to graphql-ppx!

This project builds upon mhallin/graphql_ppx. It wouldn't be possible without great work of mhallin/graphql_ppx contributors. 1