Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/dclareio/cue-wasm
- Owner: dclareio
- License: mit
- Created: 2022-06-15T20:40:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-08T20:21:48.000Z (almost 2 years ago)
- Last Synced: 2024-06-15T04:34:04.486Z (5 months ago)
- Language: JavaScript
- Size: 85.1 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cue - cue-wasm - WebAssembly based bindings for CUE in JavaScript. (Projects)
README
Cue Wasm
Wasm bindings for cue. Works with node 16+ and modern browsers thanks to microbundle
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)