Skip to content

wasm-fmt/yamlfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Dec 10, 2024
c99490e · Dec 10, 2024

History

22 Commits
Dec 10, 2024
Sep 19, 2024
Jul 4, 2024
Aug 26, 2024
Aug 26, 2024
Aug 26, 2024
Jul 4, 2024
Aug 15, 2024
Jul 4, 2024
Jul 4, 2024
Jul 4, 2024
Jul 4, 2024
Dec 10, 2024
Dec 10, 2024
Jul 4, 2024
Jul 6, 2024
Sep 19, 2024

Repository files navigation

Test

Install

npm

npm install @wasm-fmt/yamlfmt

jsr.io

npx jsr add @fmt/yamlfmt

Usage

import init, { format } from "@wasm-fmt/yamlfmt";

await init();

const input = "- a\n- b\n";

const formatted = format(input, "sample.yaml");
console.log(formatted);

For Vite users:

Add "@wasm-fmt/yamlfmt" to optimizeDeps.exclude in your vite config:

{
    "optimizeDeps": {
        "exclude": ["@wasm-fmt/yamlfmt"]
    }
}
If you cannot change the vite config, you can use another import entry
import init, { format } from "@wasm-fmt/yamlfmt/vite";

// ...

Credits

Thanks to: