watr 4.5.3 → 4.6.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": "4.5.3",
3
+ "version": "4.6.0",
4
4
  "description": "Light & fast WAT compiler – WebAssembly Text to binary, parse, print, transform",
5
5
  "main": "watr.js",
6
6
  "bin": {
@@ -14,6 +14,7 @@
14
14
  },
15
15
  "./dist": "./dist/watr.js",
16
16
  "./dist/watr.min.js": "./dist/watr.min.js",
17
+ "./dist/watr.wasm": "./dist/watr.wasm",
17
18
  "./parse": {
18
19
  "types": "./types/src/parse.d.ts",
19
20
  "default": "./src/parse.js"
@@ -42,11 +43,14 @@
42
43
  },
43
44
  "type": "module",
44
45
  "scripts": {
45
- "build": "esbuild watr.js --bundle --format=esm --outfile=dist/watr.js && esbuild watr.js --bundle --format=esm --minify --outfile=dist/watr.min.js",
46
+ "build": "npm run build:js && npm run build:wasm",
47
+ "build:js": "esbuild watr.js --bundle --format=esm --outfile=dist/watr.js && esbuild watr.js --bundle --format=esm --minify --outfile=dist/watr.min.js",
48
+ "build:wasm": "npx jz watr.js -O2 -o dist/watr.wasm",
46
49
  "test": "node test",
50
+ "test:wasm": "WATR_WASM=1 node test",
47
51
  "test:repl": "npx playwright test",
48
52
  "types": "npx tsc src/*.js watr.js --allowJs --declaration --emitDeclarationOnly --declarationMap --outDir types",
49
- "prepublishOnly": "npm test && npm run build && npm run types",
53
+ "prepublishOnly": "npm test && npm run test:wasm && npm run build && npm run types",
50
54
  "prepare": "git submodule update --init --recursive 2>/dev/null || true"
51
55
  },
52
56
  "repository": {
@@ -89,6 +93,7 @@
89
93
  "devDependencies": {
90
94
  "@playwright/test": "^1.57.0",
91
95
  "esbuild": "^0.24.2",
96
+ "jz": "^0.3.1",
92
97
  "tst": "^9.0.0"
93
98
  }
94
99
  }
package/readme.md CHANGED
@@ -50,7 +50,7 @@ npx watr input.wat # → input.wasm
50
50
  npx watr input.wat -o out.wasm # custom output
51
51
  npx watr input.wat --print # pretty-print
52
52
  npx watr input.wat --minify # minify
53
- npx watr input.wat --optimize # fold, treeshake, deadcode
53
+ npx watr input.wat --optimize # fold, treeshake, inline, coalesce, …
54
54
  npx watr input.wat --polyfill # newer features → MVP
55
55
  ```
56
56