Skip to content

dclareio/cue-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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