@wasm-fmt/gofmt 0.4.7 → 0.4.8
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 +10 -3
- package/gofmt.js +3 -1
- package/gofmt.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
[](https://github.com/wasm-fmt/gofmt/actions/workflows/test.yml)
|
|
2
|
-
[](https://www.npmjs.com/package/@wasm-fmt/gofmt)
|
|
3
2
|
|
|
4
3
|
# Install
|
|
5
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@wasm-fmt/gofmt)
|
|
6
|
+
|
|
6
7
|
```bash
|
|
7
8
|
npm install @wasm-fmt/gofmt
|
|
8
9
|
```
|
|
9
10
|
|
|
11
|
+
[](https://jsr.io/@fmt/gofmt)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx jsr add @fmt/gofmt
|
|
15
|
+
```
|
|
16
|
+
|
|
10
17
|
# Usage
|
|
11
18
|
|
|
12
19
|
```JavaScript
|
|
13
|
-
import init, { format } from
|
|
20
|
+
import init, { format } from "@wasm-fmt/gofmt";
|
|
14
21
|
|
|
15
22
|
await init();
|
|
16
23
|
|
|
@@ -28,7 +35,7 @@ console.log(formatted);
|
|
|
28
35
|
Vite users tip:
|
|
29
36
|
|
|
30
37
|
```JavaScript
|
|
31
|
-
import init, { format } from
|
|
38
|
+
import init, { format } from "@wasm-fmt/gofmt/vite";
|
|
32
39
|
```
|
|
33
40
|
|
|
34
41
|
# Build from source
|
package/gofmt.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// license that can be found in the LICENSE file.
|
|
4
4
|
//
|
|
5
5
|
// This file has been modified for use by the TinyGo compiler.
|
|
6
|
+
|
|
6
7
|
const encoder = new TextEncoder("utf-8");
|
|
7
8
|
const decoder = new TextDecoder("utf-8");
|
|
8
9
|
let reinterpretBuf = new DataView(new ArrayBuffer(8));
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
this.importObject = {
|
|
115
116
|
wasi_snapshot_preview1: {
|
|
116
117
|
// https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#fd_write
|
|
117
|
-
fd_write()
|
|
118
|
+
fd_write: () => 0, // dummy
|
|
118
119
|
},
|
|
119
120
|
gojs: {
|
|
120
121
|
// func ticks() float64
|
|
@@ -283,6 +284,7 @@
|
|
|
283
284
|
};
|
|
284
285
|
}
|
|
285
286
|
}
|
|
287
|
+
|
|
286
288
|
/**
|
|
287
289
|
* ================== End of wasm_exec.js ==================
|
|
288
290
|
*/
|
package/gofmt.wasm
CHANGED
|
Binary file
|