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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nasi/ppx-remove-deriving

v0.1.2

Published

[Esy dependency] Removes unrecognised [@@deriving] extensions by ReScript

Downloads

1

Readme

ppx-remove-deriving

This PPX rewriter attempts to remove all [@@deriving] derivers unknown to ReScript. This allows you to use any Ppxlib-compatible derivers such as ppx_let, ppx_compare, ppx_sexp_conv, etc.

Installation

For easier composition of PPXes, ppx-install is recommended.

After installing ppx-install, add the following to ppx field in package.json, ensuring that it's the last rewriter in the list:

{
  "ppx": [
    // other Ppxlib-based rewriters
    "@opam/ppx_let",
    "@opam/ppx_sexp_conv",
    "@opam/ppx_here",
    // ...
 
    // add this and ensure this is the last one
    "@nasi/ppx-remove-deriving"
  ]
}

What it does

Removes the all [@@deriving] attributes except for:

  1. jsConverter
  2. { jsConverter = newType }
  3. accessors
  4. abstract

Why this is needed

Ppxlib-compatible derivers do not remove the [@@deriving] attribute after the deriver completes, as it does not perform any code rewrite, so:

type t [@@deriving sexp]

becomes

type t [@@deriving sexp]

(* generated by ppx_sexp_conv *)
val sexp_of_t : t -> sexp
val t_of_sexp : sexp -> t

This is acceptable by the ocaml bytecode and native compilers. However, in ReScript, this would throw an error, as the ReScript compiler defines its own [@@deriving] (in this case [@@bs.deriving]) attributes, and does not know what to do with the other ones. In this case, you get the following error:

FAILED: src/utils/json.iast

  We've found a bug for you!
  src/utils/json.resi:1:11-14

  1 │ @deriving(sexp)
  2 │ type t = Js.Json.t

  sexp is not supported

To overcome this error, this deriver simply remove all deriving attributes that's unrelated to ReScript. In this way,

@deriving(sexp)
type t
@deriving(sexp, accessors)
type u = {
  // whatever, something that allows accessors to be generated
}

will be written as

type t // notice the lack of @deriving annotation

// generated by ppx_sexp_conv
let sexp_of_t : t => sexp
let t_of_sexp : sexp => t

@deriving(accessors) // incompatible deriver sexp is removed
type u = {
  // ...
}

// generated by ppx_sexp_conv
let sexp_of_u : u => sexp
let u_of_sexp : sexp => u