# relay-compiler-playground

> Compile parts of the Rust Relay compiler to Wasm and expose them as a web-based playground.

Latest version **0.0.3** (published 2021-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install relay-compiler-playground
pnpm add relay-compiler-playground
yarn add relay-compiler-playground
bun add relay-compiler-playground
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-10-13 |
| First published | 2021-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | fb, captbaritone |

## Links

- npm: https://www.npmjs.com/package/relay-compiler-playground
- npm.io page: https://npm.io/package/relay-compiler-playground

## Recent versions

- 0.0.3 (latest) — 2021-10-13
- 0.0.2 — 2021-06-02
- 0.0.1 — 2021-06-02
- 0.0.0 — 2021-06-02

## README

# Relay Compiler Playground

Compile parts of the Rust Relay compiler to Wasm and expose them as a web-based
playground.

## Build The Wasm Module

To build the wasm module:

```bash
cd relay-compiler-playground
wasm-pack build --target web
```

I had to do `rustup component add rust-src` as well.

This will create the NPM module in `relay-compiler-playground/pkg`.

## Publishing

Bump the version in `cargo.toml`. This will be used for the generated
`package.json`.

Build (see above)

Fix:

_Note:_ Wasm-pack has a bug which has been resolved, but not yet shipped in a
release which means the `files` array in the generated `package.json` file is
missing an entry. You'll need to manually update that array to include
`"relay_compiler_playground_bg.js"` before publishing:

```json
  "files": [
    "relay_compiler_playground_bg.wasm",
    "relay_compiler_playground_bg.js",
    "relay_compiler_playground.js",
    "relay_compiler_playground.d.ts"
  ],
```

More info: https://github.com/rustwasm/wasm-pack/issues/837

Finally, publish: `npm publish`

## Testing

```bash
cd relay-compiler-playground
wasm-pack build --target nodejs # NOTE: We build for node in tests and web to publish
yarn
yarn test
```

## Manually Testing

Follow the steps above for "Build The Wasm Module".

```bash
cd relay-compiler-playground/pkg
yarn link

cd ~/fbsource/xplat/js/RKJSModules/Libraries/Relay/oss/__github__/website
yarn link relay-compiler-playground

# Launch the website in dev mode
yarn start
```

Navigate to `http://localhost:3000/compiler-playground`

---
_Source: https://npm.io/package/relay-compiler-playground · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
