watr 3.0.0 → 3.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watr",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Ligth & fast WAT compiler",
5
5
  "main": "watr.js",
6
6
  "exports": {
@@ -42,9 +42,6 @@
42
42
  },
43
43
  "homepage": "https://github.com/dy/watr#readme",
44
44
  "devDependencies": {
45
- "tst": "^7.3.0",
46
- "wabt": "^1.0.28",
47
- "wassemble": "^0.0.2",
48
- "wat-compiler": "^1.0.0"
45
+ "tst": "^8.0.2"
49
46
  }
50
47
  }
package/readme.md CHANGED
@@ -1,7 +1,10 @@
1
- # watr [![test](https://github.com/audio-lab/watr/actions/workflows/test.js.yml/badge.svg)](https://github.com/audio-lab/watr/actions/workflows/test.js.yml) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/watr/latest?color=brightgreen&label=gzip)](https://bundlephobia.com/package/watr) [![npm](https://img.shields.io/npm/v/watr?color=red)](https://npmjs.org/watr)
1
+ # watr [![test](https://github.com/audio-lab/watr/actions/workflows/test.js.yml/badge.svg)](https://github.com/audio-lab/watr/actions/workflows/test.js.yml) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/watr/latest?color=brightgreen&label=gzip)](https://bundlephobia.com/package/watr) [![npm](https://img.shields.io/npm/v/watr?color=white)](https://npmjs.org/watr)
2
2
 
3
- Light & fast WASM compiler. An alternative to [wabt/wat2wasm](https://github.com/AssemblyScript/wabt.js).<br/>
4
- Useful for hi-level languages or dynamic (in-browser) compilation.<br>
3
+ Light & fast WAT compiler.<br/>
4
+ Useful for high-level languages or dynamic (in-browser) compilation.<br/>
5
+ Supports full [spec text syntax](https://webassembly.github.io/spec/core/text/index.html) and [official testsuite](https://github.com/WebAssembly/testsuite).
6
+
7
+ **[REPL](https://dy.github.io/watr/docs/repl)**
5
8
 
6
9
  ## Usage
7
10
 
@@ -54,18 +57,19 @@ print(src, {
54
57
  indent: ' ',
55
58
  newline: '\n',
56
59
  })
57
- // (func (export "double")
58
- // (param f64) (result f64)
59
- // (f64.mul
60
- // (local.get 0)
61
- // (f64.const 2)))
60
+ // (func
61
+ // (export "double")
62
+ // (param f64)
63
+ // (result f64)
64
+ // (f64.mul (local.get 0) (f64.const 2))
65
+ // )
62
66
 
63
67
  // minify
64
68
  print(src, {
65
69
  indent: false,
66
70
  newline: false
67
71
  })
68
- // (func (export "double")(param f64)(result f64)(f64.mul (local.get 0)(f64.const 2)))
72
+ // (func(export "double")(param f64)(result f64)(f64.mul(local.get 0)(f64.const 2)))
69
73
  ```
70
74
 
71
75
  <!-- See [REPL](https://audio-lab.github.io/watr/repl.html).-->
@@ -73,35 +77,25 @@ print(src, {
73
77
  ## Status
74
78
 
75
79
  * [x] core
76
- * [x] [mutable_globals](https://github.com/WebAssembly/mutable-global)
77
- * [x] [extended const](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md)
78
- * [ ] [sat_float_to_int](https://github.com/WebAssembly/nontrapping-float-to-int-conversions)
79
- * [ ] [sign_extension](https://github.com/WebAssembly/sign-extension-ops)
80
- * [x] [multi-value](https://github.com/WebAssembly/spec/blob/master/proposals/multi-value/Overview.md)
81
- * [x] [bulk memory ops](https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md)
82
- * [ ] [memory64](https://github.com/WebAssembly/memory64)
83
- * [x] [multiple memories](https://github.com/WebAssembly/multi-memory/blob/master/proposals/multi-memory/Overview.md)
84
- * [x] [simd](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md)
85
- * [ ] [relaxed_simd](https://github.com/WebAssembly/relaxed-simd)
86
- * [x] [ref types](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)
87
- * [x] [func refs](https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md)
88
- * [ ] [gc](https://github.com/WebAssembly/gc)
80
+ * [x] [mutable globals](https://github.com/WebAssembly/mutable-global), [extended const](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md), [nontrapping float to int](https://github.com/WebAssembly/nontrapping-float-to-int-conversions), [sign extension](https://github.com/WebAssembly/sign-extension-ops)
81
+ * [x] [multi-value](https://github.com/WebAssembly/spec/blob/master/proposals/multi-value/Overview.md), [bulk memory ops](https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md), [multiple memories](https://github.com/WebAssembly/multi-memory/blob/master/proposals/multi-memory/Overview.md)
82
+ * [x] [simd](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md), [relaxed simd](https://github.com/WebAssembly/relaxed-simd), [fixed-width simd](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md)
83
+ * [x] [tail_call](https://github.com/WebAssembly/tail-call)
84
+ * [x] [ref types](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md), [func refs](https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md)
85
+ * [x] [gc](https://github.com/WebAssembly/gc)
89
86
  * [ ] [exceptions](https://github.com/WebAssembly/exception-handling)
90
- * [ ] [threads](https://github.com/WebAssembly/threads)
91
- * [ ] [tail_call](https://github.com/WebAssembly/tail-call)
92
- * [ ] [annotations](https://github.com/WebAssembly/annotations)
93
- * [ ] [code_metadata](https://github.com/WebAssembly/tool-conventions/blob/main/CodeMetadata.md)
87
+ * [ ] [memory64](https://github.com/WebAssembly/memory64)
88
+ * [ ] [annotations](https://github.com/WebAssembly/annotations), [code_metadata](https://github.com/WebAssembly/tool-conventions/blob/main/CodeMetadata.md)
89
+ * [ ] [js strings](https://github.com/WebAssembly/js-string-builtins/blob/main/proposals/js-string-builtins/Overview.md)
94
90
 
95
91
  ## Alternatives
96
92
 
97
- &nbsp; | Size (gzipped) | Performance (op/s)
93
+ &nbsp; | Size (gzipped) | Performance
98
94
  ---|---|---
99
- watr | 5 kb | 6000
100
- [wabt](https://github.com/AssemblyScript/wabt.js) | 300 kb | 574
101
- [wat-compiler](https://github.com/stagas/wat-compiler) | 6 kb | 348
102
- <!-- [wassemble](https://github.com/wingo/wassemble) | ? kb | ? -->
103
-
104
- <!-- Watr has better syntax support than wabt & produces more compact output due to types squash. -->
95
+ watr | 6.2 kb | 11.6 op/s
96
+ [spec/wast.js](https://github.com/WebAssembly/spec/tree/main/interpreter#javascript-library) | 216 kb | 7.1 op/s
97
+ [wabt](https://github.com/WebAssembly/wabt) | 282 kb | 2.3 op/s
98
+ [wat-compiler](https://github.com/stagas/wat-compiler) | 7.7 kb | 1.34 op/s
105
99
 
106
100
  <!--
107
101
  ## Projects using watr
@@ -118,20 +112,4 @@ watr | 5 kb | 6000
118
112
  * [WASM binary encoding](https://github.com/WebAssembly/design/blob/main/BinaryEncoding.md)
119
113
  -->
120
114
 
121
- <!--
122
- ## Refs
123
-
124
- * [mdn wasm text format](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format)
125
- * [wasm reference manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md)
126
- * [wabt source search](https://github.com/WebAssembly/wabt/search?p=5&q=then)
127
- * [wat control flow](https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow)
128
- * [ontouchstart wasm book](https://ontouchstart.pages.dev/chapter_wasm_binary)
129
- * [hackernoon](https://web.archive.org/web/20210215171830/https://hackernoon.com/webassembly-binary-format-explained-part-2-hj1t33yp?source=rss)
130
- * [webassemblyjs](https://github.com/xtuc/webassemblyjs)
131
- * [chasm](https://github.com/ColinEberhardt/chasm/blob/master/src/encoding.ts)
132
- * [WebBS](https://github.com/j-s-n/WebBS)
133
- * [leb128a](https://github.com/minhducsun2002/leb128/blob/master/src/index.ts)
134
- * [leb128b](https://github.com/shmishtopher/wasm-LEB128/tree/master/esm)
135
- -->
136
-
137
115
  <p align=center><a href="https://github.com/krsnzd/license/">🕉</a></p>