Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Wasm based bindings for cue in javascript
https://github.com/dclareio/cue-wasm

Last synced: 3 months ago
JSON representation

Wasm based bindings for cue in javascript

Awesome Lists containing this project

README

        

Cue Wasm


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



contributors


last update


forks


stars


open issues


license


Documentation
·
Report Bug
·
Request Feature



# :notebook_with_decorative_cover: Table of Contents

- [Features](#dart-features)
- [Getting Started](#toolbox-getting-started)
* [Prerequisites](#bangbang-prerequisites)
* [Installation](#gear-installation)
* [Run Locally](#running-run-locally)
- [Usage](#eyes-usage)
- [Roadmap](#compass-roadmap)
- [Contributing](#wave-contributing)
* [Code of Conduct](#scroll-code-of-conduct)
- [License](#warning-license)
- [Contact](#handshake-contact)
- [Acknowledgements](#gem-acknowledgements)

## :dart: 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"

## :toolbox: Getting Started

### :gear: Installation

Install cue-wasm with yarn

```bash
yarn add cue-wasm
```

### :running: Build Locally

Clone the project

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

Go to the project directory

```bash
cd cue-wasm
```

Install dependencies

```bash
yarn
```

Build the library (requires docker)

```bash
yarn build
```

## :eyes: Usage

```javascript
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"`
```

## :compass: Roadmap

* [x] CUE -> JSON/JS
* [X] CUE -> OpenAPI
* [X] CUE -> JSONSchema
* [X] CUE -> AST
* [ ] CUE -> Typescripe Types
* [ ] CUE -> Protobufs
* [ ] JSON/JS -> CUE
* [ ] JSONSchema -> CUE
* [ ] Typescripe Types -> CUE
* [ ] Protobufs -> CUE

## :warning: License

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

## :handshake: Contact

[@dclario](https://twitter.com/dclareio) - https://dclare.io - [email protected] - **We do consulting!!**

Project Link: [https://github.com/dclareio/cue-wasm](https://github.com/dclareio/cue-wasm)

## :gem: Acknowledgements

- [CUE](https://github.com/cue-lang/cue)
- [microbundle](https://github.com/developit/microbundle)