Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-yaml

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-yaml

Convert .yaml and .yml files to ES6 modules:

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
129
decreased by-35.82%
Maintainers
2
Weekly downloads
 
Created
Source

rollup-plugin-yaml

Convert .yaml and .yml files to ES6 modules:

// import a single property from a YAML file
import { foo } from './config.yaml';

// import the whole file as an object
import config from './config.yaml';

Installation

npm install --save-dev rollup-plugin-yaml

Usage

import { rollup } from 'rollup';
import yaml from 'rollup-plugin-yaml';

rollup({
  entry: 'main.js',
  plugins: [
    yaml({
      // All YAML files will be parsed by default,
      // but you can also specifically include/exclude files
      include: 'node_modules/**',  // Default: undefined
      exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ],  // Default: undefined
      // optionally mutate parsed yaml with a transform function.
      // The transform function may either:
      // - return an updated version of the yaml content
      // - return `undefined`, and mutate the yaml content directly
      transform(data) {
        if (Array.isArray(data))
          return data.filter((element) => !element.private);
      }
    })
  ]
});

License

MIT

FAQs

Package last updated on 18 Oct 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc