ttmg-wasm-tool 1.0.3 → 1.0.4
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 +3 -52
- package/build/Release/wasm_tool_node.node +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ttmg-wasm-tool
|
|
2
2
|
|
|
3
3
|
Native Node.js module for WASM preparation and splitting. Supports macOS and Windows.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install ttmg-wasm-tool
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
This will automatically compile the native module during installation.
|
|
@@ -22,10 +22,8 @@ This will automatically compile the native module during installation.
|
|
|
22
22
|
|
|
23
23
|
### prepareWasm(wasmBuffer: Buffer): PrepareResult
|
|
24
24
|
|
|
25
|
-
Prepare a WASM module by inserting `scwebgl.logCall` instrumentation at the beginning of each function.
|
|
26
|
-
|
|
27
25
|
```typescript
|
|
28
|
-
import { prepareWasm } from '
|
|
26
|
+
import { prepareWasm } from 'ttmg-wasm-tool';
|
|
29
27
|
import { readFileSync, writeFileSync } from 'fs';
|
|
30
28
|
|
|
31
29
|
const wasm = readFileSync('input.wasm');
|
|
@@ -98,50 +96,3 @@ interface SplitResult {
|
|
|
98
96
|
subWasmBuffer?: Buffer;
|
|
99
97
|
}
|
|
100
98
|
```
|
|
101
|
-
|
|
102
|
-
## Split Rules
|
|
103
|
-
|
|
104
|
-
The WASM splitting follows these rules:
|
|
105
|
-
|
|
106
|
-
1. All import functions and element segment functions go to the main package
|
|
107
|
-
2. Functions directly called from main package that don't exist create stub functions with `scwebgl.wait` calls
|
|
108
|
-
3. Sub package contains all functions not in the main package
|
|
109
|
-
4. Sub package functions get `scwebgl.logCall` instrumentation
|
|
110
|
-
5. Non-import global variables are converted to imports for sharing between packages
|
|
111
|
-
|
|
112
|
-
## Building from Source
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
# Install dependencies
|
|
116
|
-
npm install
|
|
117
|
-
|
|
118
|
-
# Build (Release)
|
|
119
|
-
npm run build
|
|
120
|
-
|
|
121
|
-
# Build (Debug)
|
|
122
|
-
npm run build:debug
|
|
123
|
-
|
|
124
|
-
# Clean build artifacts
|
|
125
|
-
npm run clean
|
|
126
|
-
|
|
127
|
-
# Rebuild
|
|
128
|
-
npm run rebuild
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Pre-built Binaries
|
|
132
|
-
|
|
133
|
-
To create pre-built binaries for distribution:
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
# Current platform
|
|
137
|
-
npm run prebuild
|
|
138
|
-
|
|
139
|
-
# Specific platforms
|
|
140
|
-
npm run prebuild:win32
|
|
141
|
-
npm run prebuild:darwin
|
|
142
|
-
npm run prebuild:darwin-arm64
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## License
|
|
146
|
-
|
|
147
|
-
MIT
|
|
Binary file
|