esbuild-plugin-yaml-import
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

esbuild-plugin-yaml-import

ESBuild plugin for yaml import, by JS-YAML.

Usage

GitHub Repository/Homepage is private for now, if you got any troubles, just open issue in this repo.

npm i esbuild-plugin-yaml-import -D
pnpm i esbuild-plugin-yaml-import -D
yarn add esbuild-plugin-yaml-import -D
import { build } from 'esbuild';
import yaml from 'esbuild-plugin-yaml-import';

(async () => {
  const res1 = await build({
    entryPoints: ['./demo.tsx'],
    bundle: true,
    outfile: './dist/main.js',
    plugins: [yaml()],
  });
})();

Yaml content will be parsed as JSON, and processed by ESBuild json loader.

Configuration

See JS-YAML documents for details.

export interface Options {
  // JS-YAML load options
  jsyamlLoadOptions?: JSYamlOptions;

 // transform YAML content after read file
  transformContent?: (content: string) => string;

  // transform parsed content after load
  transformParsed?: (
    data: string | number | object,
    filePath: string
  ) => object | undefined;
}

Package Sidebar

Install

npm i esbuild-plugin-yaml-import

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

4.72 kB

Total Files

6

Last publish

Collaborators

  • linbudu