Skip to content

dclareio/cue-wasm

Folders and files

NameName
Last commit message
Last commit date
Dec 8, 2022
Dec 8, 2022
Jun 16, 2022
Dec 8, 2022
Jun 16, 2022
Jun 19, 2022
Dec 8, 2022
Jun 15, 2022
Dec 8, 2022
Dec 8, 2022
Dec 8, 2022
Dec 8, 2022
Dec 8, 2022
Aug 2, 2022

Repository files navigation

Cue Wasm

Wasm bindings for cue. Works with node 16+ and modern browsers thanks to microbundle

contributors last update forks stars open issues license


πŸ“” Table of Contents

🎯 Features

  • Cue to json cue.toJSON()
  • Cue to js object cue.parse()
  • Highly optimized - 2.1MB gzipped bundle size when using "slim" variant, 4.2MB for "full"

🧰 Getting Started

βš™οΈ Installation

Install cue-wasm with yarn

  yarn add cue-wasm

πŸƒ Build Locally

Clone the project

  git clone https://github.com/dclareio/cue-wasm.git

Go to the project directory

  cd cue-wasm

Install dependencies

  yarn

Build the library (requires docker)

  yarn build

πŸ‘€ Usage

import CUE from 'cue-wasm'

const cue = await CUE.init();

// basic API
cue.parse('hello: "world"')  // returns { hello: "world" }

// Tagged template literals
const mergeObj = { test: "test" }
const obj = cue`
  key: "val"
  test: string
  ${mergeObj}
`; // returns { test: "test", key: "val" }

// note that for strings you'll need to quote them manually if you
// don't want cue to interpret them literally. This allows dynamically
// writing cue e.g.

cue`test: ${"test"}` // evaluates `test: test` vs.
cue`test: "${"test"}"` // evaluates `test: "test"`

🧭 Roadmap

  • CUE -> JSON/JS
  • CUE -> OpenAPI
  • CUE -> JSONSchema
  • CUE -> AST
  • CUE -> Typescripe Types
  • CUE -> Protobufs
  • JSON/JS -> CUE
  • JSONSchema -> CUE
  • Typescripe Types -> CUE
  • Protobufs -> CUE

⚠️ License

Distributed under the MIT License. See LICENSE for more information.

🀝 Contact

@dclario - https://dclare.io - contact@dclare.io - We do consulting!!

Project Link: https://github.com/dclareio/cue-wasm

πŸ’Ž Acknowledgements