Commit c156889
authored
feat(plugin): support native Go plugins with WASI (wasip1) (#71)
* deps: update Go version and wazero to v1.9.0
- Upgrade Go version from 1.22 to 1.24.0
- Update wazero dependency from v1.7.0 to v1.9.0
- Update corresponding go.sum entries
* refactor: migrate from TinyGo to standard Go Wasm support
This commit updates the project to use standard Go's WebAssembly support instead of TinyGo:
- Replace TinyGo-specific build constraints with `wasip1`
- Update Makefile to use standard Go Wasm compilation
- Modify plugin initialization to use `init()` instead of `main()`
- Update memory management functions
- Replace `//export` with `//go:wasmexport`
- Update README and documentation references
- Regenerate protobuf files with updated protoc version
The changes enable broader compatibility with Go's native Wasm support while maintaining the existing plugin architecture.
* test(host-functions): add test for standard Go Wasm plugin with JSON parsing
This commit adds a new test case for a WebAssembly plugin using standard Go's JSON parsing and host function capabilities:
- Implement a new test function `TestStd` in host_functions_test.go
- Create a new plugin implementation in plugin-std/plugin.go
- Demonstrate JSON unmarshaling and string formatting in a Wasm plugin
- Use `WithStdout` to enable standard output handling
- Verify plugin interaction with a sample greeting scenario
* docs: remove JSON parsing references for TinyGo
Clean up README by removing outdated JSON parsing notes specific to TinyGo, including:
- Remove section about JSON parsing limitations
- Delete links to JSON parsing libraries
- Remove reference to JSON parsing example link1 parent d8d4205 commit c156889
File tree
102 files changed
+396
-297
lines changed- .github/workflows
- examples
- helloworld
- greeting
- plugin-evening
- plugin-morning
- host-function-library
- library/json-parser/export
- plugin
- proto
- host-functions
- greeting
- plugin
- known-types
- known
- plugin
- wasi
- cat
- plugin
- gen
- tests
- fields
- plugin
- proto
- host-functions
- plugin-empty
- plugin-std
- plugin
- proto
- import
- plugin
- proto
- bar
- foo
- well-known
- plugin
- proto
- types/known
- anypb
- durationpb
- emptypb
- sourcecontextpb
- structpb
- timestamppb
- typepb
- wrapperspb
- wasm
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
102 files changed
+396
-297
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 20 | | |
28 | 21 | | |
29 | | - | |
| 22 | + | |
30 | 23 | | |
31 | 24 | | |
32 | | - | |
| 25 | + | |
33 | 26 | | |
34 | 27 | | |
35 | 28 | | |
| |||
48 | 41 | | |
49 | 42 | | |
50 | 43 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 44 | | |
57 | | - | |
| 45 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
60 | | - | |
| 58 | + | |
| 59 | + | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
84 | 77 | | |
85 | 78 | | |
86 | 79 | | |
| |||
106 | 99 | | |
107 | 100 | | |
108 | 101 | | |
109 | | - | |
| 102 | + | |
110 | 103 | | |
111 | 104 | | |
112 | 105 | | |
| |||
176 | 169 | | |
177 | 170 | | |
178 | 171 | | |
179 | | - | |
| 172 | + | |
180 | 173 | | |
181 | 174 | | |
182 | 175 | | |
| |||
186 | 179 | | |
187 | 180 | | |
188 | 181 | | |
189 | | - | |
190 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
191 | 186 | | |
192 | 187 | | |
193 | 188 | | |
| |||
200 | 195 | | |
201 | 196 | | |
202 | 197 | | |
203 | | - | |
| 198 | + | |
204 | 199 | | |
205 | 200 | | |
206 | | - | |
| 201 | + | |
207 | 202 | | |
208 | 203 | | |
209 | 204 | | |
| |||
341 | 336 | | |
342 | 337 | | |
343 | 338 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | 339 | | |
353 | 340 | | |
354 | 341 | | |
| |||
392 | 379 | | |
393 | 380 | | |
394 | 381 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | 382 | | |
399 | 383 | | |
400 | 384 | | |
| |||
409 | 393 | | |
410 | 394 | | |
411 | 395 | | |
412 | | - | |
413 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
414 | 400 | | |
415 | 401 | | |
416 | 402 | | |
417 | 403 | | |
418 | 404 | | |
| 405 | + | |
419 | 406 | | |
420 | 407 | | |
421 | 408 | | |
| |||
428 | 415 | | |
429 | 416 | | |
430 | 417 | | |
431 | | - | |
| 418 | + | |
432 | 419 | | |
433 | 420 | | |
434 | 421 | | |
| |||
512 | 499 | | |
513 | 500 | | |
514 | 501 | | |
515 | | - | |
516 | | - | |
517 | 502 | | |
518 | 503 | | |
519 | 504 | | |
520 | 505 | | |
521 | 506 | | |
522 | | - | |
523 | | - | |
| 507 | + | |
524 | 508 | | |
525 | 509 | | |
526 | 510 | | |
| |||
530 | 514 | | |
531 | 515 | | |
532 | 516 | | |
533 | | - | |
534 | 517 | | |
535 | 518 | | |
536 | 519 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 7 | | |
12 | | - | |
13 | 8 | | |
14 | 9 | | |
15 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
0 commit comments