@yuku-codegen/wasm 0.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/encode.js +2367 -0
- package/index.d.ts +6 -0
- package/index.js +47 -0
- package/package.json +31 -0
- package/yuku-codegen.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# yuku-codegen-wasm
|
|
2
|
+
|
|
3
|
+
The [`yuku-codegen`](https://www.npmjs.com/package/yuku-codegen) code generator
|
|
4
|
+
as a single WebAssembly module. Takes a `Program` from `yuku-parser-wasm` and
|
|
5
|
+
returns generated source.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { parse } from "yuku-parser-wasm";
|
|
11
|
+
import { print, strip, minify } from "yuku-codegen-wasm";
|
|
12
|
+
|
|
13
|
+
const { program } = parse("const x: number = 1", { lang: "ts" });
|
|
14
|
+
|
|
15
|
+
print(program); // formatted source
|
|
16
|
+
strip(program); // TypeScript stripped to JavaScript
|
|
17
|
+
minify(program); // compact, comments dropped
|
|
18
|
+
```
|