JSPM

esbuild-plugin-yaml

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5318
  • Score
    100M100P100Q126304F
  • License MIT

Convert YAML files to ES6 modules

Package Exports

  • esbuild-plugin-yaml

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (esbuild-plugin-yaml) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

esbuild-plugin-yaml

Use YAML files as ES6 modules with esbuild.

Install

yarn add -D esbuild-plugin-yaml

or

npm i -D esbuild-plugin-yaml

Usage

Add to your esbuild plugins list:

const esbuild = require("esbuild");
const { yamlPlugin } = require("esbuild-plugin-yaml");

esbuild.build({
  ...
  plugins: [
    yamlPlugin()
  ]
  ...
});

Options

You can add your own custom configuration of options to esbuild-plugin-yaml:

yamlPlugin({
  // options
});

loadOptions

LoadOptions by js-yaml.

transform

A function which can mutate parsed YAML. It should return an object or undefined (that will make no changes to the parsed YAML).

  transform(data, filePath) {
    // transform the yaml file
    // the file content will be in the "data" field
    // the file path will be in the "filePath" field
    return { filePath, data };
  }