Feature: Ignore optional export interfaces
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- go, wasm
- 领域
- build-system, tooling
调研方向
使用 WIT worlds、componentize-go.toml 和 gen/wit_exports 文件重现该设置,包括独立的 CLI 和 HTTP 变体。先从 componentize-go build command 和报告的 world 解码错误开始,然后确定 world 选择或可选 exports 应如何工作。当 CLI、HTTP 和 client-only 构建只导出它们所需的接口时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Description
Currently running into a little issue with an SDK I'm writing. This SDK wraps, among other things, the wasi:cli and the wasi:http interfaces. The setup is something as follows.
WIT:
package jamesstocktonj1:componentize-sdk;
world http {
export wasi:http/[email protected];
}
world cli {
export wasi:cli/[email protected];
}
world all {
include sdk;
include http;
include cli;
}
Componentize Go Toml:
wit_paths = ["./wit"]
worlds = [
"sdk",
"http",
"cli"
]
Issue 1
When I import this package (for example the net/wasihttp path), it builds a component which exports BOTH wasi:http and wasi:cli and then same is true when trying to write a CLI application.
I've tried splitting the gen/wit_exports file into gen/wit_exports_cli and gen/wit_exports_http but componentize-go complains that:
Error: failed to encode component from module
Caused by:
0: failed to decode world from module
1: module was not valid
2: failed to find export of interface `wasi:cli/[email protected]` function `run`
Issue 2
We also have a scenario where we want to export neither CLI or HTTP but instead just want to use the http.Client interface. This again causes the component to export both interface although neither are needed.
Summary
- How can we make certain wit interfaces optional?
- Would it be possible to have optional exports depending on what Go module path is imported?
- Having a
go.modandcomponentize-go.tomlfor each path would be possible but quite wasteful
- Having a
- Can this be done without having to specify a specific interface? e.g.
componentize-go --world foo build ... - Can we fix this in the Componentize Go build side?
For more context this is the SDK in question:
https://github.com/jamesstocktonj1/componentize-sdk
- 主要语言
- Rust
- 星标
- 19
- 派生
- 8
- 平均合并
- 11 天 20 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bytecodealliance/componentize-go 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 58/100
bytecodealliance/componentize-go#66 · 1 条评论 ·
查看 bytecodealliance/componentize-go 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 3 天内回复
-
Zellij doesn't validate hex colors correctly and crashes可能已有人在做 @ymcx 今天认领。 未关闭suspected bug
难度 2/5 1-3 小时 新手友好度 76/100
zellij-org/zellij#5732 ·
维护者通常 1 天内回复
-
bug rust
难度 2/5 1-3 小时 新手友好度 78/100
jonathanong/no-mistakes#2267 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
rust-embedded/cortex-m#702 · 1 条评论 ·
-
Make major, minor, and makedev safe on solarish targets可能已有人在做 @xtqqczze 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复