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

rollup-plugin-yamlx

v0.0.1

Published

An enhanced Rollup/Vite plugin which converts YAML files to ES6 modules.

Readme

rollup-plugin-yamlx

npm size license types

🍣 An enhanced Rollup/Vite plugin which converts YAML files to ES6 modules.

Install

$ npm install -D rollup-plugin-yamlx
# or
# yarn add -D rollup-plugin-yamlx

Usage

Create a rollup.config.js configuration file and import the plugin:

import PluginYamlX from 'rollup-plugin-yamlx'

export default {
  plugins: [PluginYamlX()]
}

Then call rollup either via the CLI or the API.

With an accompanying file src/index.js, the local heroes.yaml file would now be importable as seen below:

// src/index.js
import { batman } from './heroes.yaml?named';

console.log(`na na na na ${batman}`);

Options

Import Options

Users can use below query params in import path to specify how the plugin converts yaml to esm.

  • multi - get an array of documents of the yaml file.
  • single - get one of the documents of the yaml file.
  • index - use index to specify which one document should be returned when 'single' is enabled.
  • named - generate named-exports for the top-level fields of the returned document.
  • no-named - do not generate named-exports. This option is always enabled when 'multi' enabled.
  • default - generate default-export for the returned document.
  • no-default - do not generate default-export for the returned document.

By default single and default is enabled, and index is 0, which means you can get default-export of the first document in some.yaml easily:

import doc from 'some.yaml'

See test cases for more examples.

Plugin Options

declare type YamlXOptions = {
    /**
     * A minimatch pattern, or array of patterns, which specifies the files in the build the plugin
     * should operate on.
     * By default all files are targeted.
     */
    include?: FilterPattern;
    /**
     * A minimatch pattern, or array of patterns, which specifies the files in the build the plugin
     * should _ignore_.
     * By default no files are ignored.
     */
    exclude?: FilterPattern;
    /**
     * A function which can optionally mutate parsed YAML.
     * The function should return the mutated result, or `undefined` which will make no changes to
     * the parsed YAML.
     */
    transform?: (data: ValidYamlType, filePath: string) => ValidYamlType | undefined;
    /**
     * Schema used to parse yaml files.
     * See https://github.com/nodeca/js-yaml/blob/49baadd52af887d2991e2c39a6639baa56d6c71b/README.md#load-string---options-
     */
    schema?: Schema;
};

License

MIT License © 2021 unbyte