Socket
Socket
Sign inDemoInstall

esbuild-yaml

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-yaml

An esbuild plugin, that allows imports of YAML files


Version published
Weekly downloads
2.1K
increased by7.03%
Maintainers
0
Weekly downloads
 
Created
Source

esbuild-yaml

npm version npm downloads

📦 Installation

npm install --save-dev esbuild-yaml esbuild

📚 Usage

Add this to your build file

import { build } from "esbuild";
import { YAMLPlugin } from "esbuild-yaml";

const yourConfig = {};

build({
  ...yourConfig,
  plugins: [
    YAMLPlugin()
  ]
});

TypeScript

If you are using TypeScript, you need to add the following to your tsconfig.json file:

{
  "compilerOptions": {
    "types": [
      "esbuild-yaml/types"
    ]
  }
}

📖 Examples

// build.js
import { build } from "esbuild";
import { YAMLPlugin } from "esbuild-yaml";

const yourConfig = {};

build({
  ...yourConfig,
  plugins: [
    YAMLPlugin()
  ]
});
# config.yaml
name: esbuild-yaml

version: 1.0.0
// index.ts

import config from "./config.yaml"; // this will be converted to a JSON object
import configRaw from "./config.yaml?raw"; // this will be the raw YAML string

console.log(config); // { name: "esbuild-yaml", version: "1.0.0" }
console.log(configRaw); // name: esbuild-yaml\nversion: 1.0.0

📄 License

Published under MIT License.

Keywords

FAQs

Package last updated on 30 Jun 2024

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