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

@arnau/gatsby-transformer-toml

v1.0.2

Published

Gatsby transformer plugin for toml

Downloads

41

Readme

gatsby-transformer-toml

Use the latest version of TOML in your Gatsby site and control what GraphQL type a file should use.

gatsby-transformer-toml is a Gatsby plugin to transform TOML files into Gatsby nodes.

It uses ion-parser to parse TOML files. It's fast, small and has no dependencies.

Problem

Gatsby's gatsby-transformer-toml works only form TOML 0.4 and it makes a GraphQL type per file.

If you find yourself in need of controlling what types should be used for your TOML files, this plugin may be a solution for you.

Install

yarn add @arnau/gatsby-transformer-toml

Usage

// In your gatsby-config.js
plugins: ['@arnau/gatsby-transformer-toml']

Example

Let's say you have a TOML files without a type attribute:

# settings.toml

description = "My settings outside gatsby-config.js"

[licence]
id = "mit"
label = "MIT License"
url = "https://choosealicense.com/licenses/mit/"

[[editors]]
id = "arnau"
name = "Arnau Siches"

By default if no type is provided it uses TOML so you can query the above like:

query {
  toml {
    description
    licence {
      label
      url
    }
  }
}

Resulting in:

{
  data: {
    toml: {
      description: "My settings outside gatsby-config.js",
      licence: {
        label: "MIT License",
        url: "https://choosealicense.com/licenses/mit/"
      }
    }
  }
}

If you have two TOML files with different structures, Gatsby will merge them under the same type. Enter the type attribute:

# data/tools/gatsby.toml

type = "Tool"
id = "gatsby"
name = "Gatsby"
url = "https://www.gatsbyjs.org/"
# data/tools/netlify.toml

type = "Tool"
id = "netlify"
name = "Netlify"
url = "https://www.netlify.com/"

This time we can query specifically all nodes of type Tool:

query {
  allTool {
    name
    url
  }
}

Resulting in:

{
  data: {
    allTool: [
      {
        name: "Gatsby",
        url: "https://www.gatsbyjs.org/"
      },
      {
        name: "Netlify",
        url: "https://www.netlify.com/"
      },
    ]
  }
}

Finally, if you need to query all nodes generated from TOML files, you can rely on the fact that all of them have the internal media type application/toml:

// gatsby-node.js

exports.onCreateNode = ({ node, actions }) => {
  if (node.internal.mediaType === 'application/toml') {
    // do stuff
  }
}

Options

defaultType

The defaultType option allows to override the default type TOML. For example:

// gatsby-config.js

plugins: [
  {
    resolve: '@arnau/gatsby-transformer-toml',
    options: {
      defaultType: 'ION'
    }
  }
]

extensions

The extensions option allows to override the default extension list. For example:

// gatsby-config.js

plugins: [
  {
    resolve: '@arnau/gatsby-transformer-toml',
    options: {
      defaultType: 'ION',
      extensions: ['toml', 'ion']
    }
  }
]

Development

This plugin is fairly trivial, the following should be enough to get you started:

yarn install && yarn test

Licence

Licensed under the MIT licence