5个版本

0.3.4 2023年11月13日
0.3.3 2023年8月29日
0.3.2 2023年6月2日
0.3.1 2023年6月2日
0.3.0 2023年4月11日

#400 in WebAssembly

Download history 21/week @ 2024-03-29 1/week @ 2024-04-05 10/week @ 2024-04-19 91/week @ 2024-04-26 5/week @ 2024-05-17 3/week @ 2024-05-24 4/week @ 2024-05-31 5/week @ 2024-06-07 47/week @ 2024-06-14 99/week @ 2024-06-21 328/week @ 2024-06-28 128/week @ 2024-07-05 347/week @ 2024-07-12

930每月下载次数

Apache-2.0 WITH LLVM-exception

145KB
1.5K SLoC

描述

wit-deps是一个简单的WIT依赖管理器二进制和Rust库,它管理你的wit/deps。其主要目标是确保你的wit/deps中的一切都与你的依赖清单(默认:wit/deps.toml)和依赖锁定(默认:wit/deps.lock)保持一致。

清单

依赖清单是一个将依赖名称映射到其源规范的TOML编码表。在其最简单形式中,源规范是一个包含具有wit子目录的目录树的gzipped tarball的URL字符串,该子目录包含wit文件。

示例

# wit/deps.toml
# Use `wit-deps update` to pull in latest changes from "dynamic" branch references
clocks = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
http = "https://github.com/WebAssembly/wasi-http/archive/main.tar.gz"
messaging = "https://github.com/WebAssembly/wasi-messaging/archive/main.tar.gz"
sockets = "https://github.com/WebAssembly/wasi-sockets/archive/main.tar.gz"
sql = "https://github.com/WebAssembly/wasi-sql/archive/main.tar.gz"

# Pin to a tag
io = "https://github.com/rvolosatovs/wasi-io/archive/v0.1.0.tar.gz" # this fork renames `streams` interface for compatiblity with wasi-snapshot-preview1

# Pin a dependency to a particular revision and source digests. Each digest is optional
[keyvalue]
url = "https://github.com/WebAssembly/wasi-keyvalue/archive/6f3bd6bca07cb7b25703a13f633e05258d56a2dc.tar.gz"
sha256 = "1755b8f1e9f2e70d0bde06198bf50d12603b454b52bf1f59064c1877baa33dff"
sha512 = "7bc43665a9de73ec7bef075e32f67ed0ebab04a1e47879f9328e8e52edfb35359512c899ab8a52240fecd0c53ff9c036abefe549e5fb99225518a2e0446d66e0"

源规范也可以是具有以下字段的构造

  • url - 与URL字符串相同的格式
  • sha256 - (可选) URL内容的十六进制编码sha256摘要
  • sha512 (可选) URL内容的十六进制编码sha512摘要
  • path WIT定义包含的目录的路径

必须指定urlpath(两者都支持字符串格式)

示例

# wit/deps.toml
mywit = "./path/to/my/wit"

[logging]
url = "https://github.com/WebAssembly/wasi-logging/archive/d106e59b25297d0496e6a5d221ad090e19c3aaa3.tar.gz"
sha256 = "4bb4aeab99e7323b30d107aab78e88b2265c1598cc438bc5fbc0d16bb63e798f"
sha512 = "13b52b59afd98dd4938e3a651fad631d41a2e84ce781df5d8957eded77a8e1ac4277e771a10225cd4a3a9eae369ed7e8fee6e26f9991a2caa7c97c4a758b1ae6"

用法

请注意,wit-deps假定它对wit/deps拥有完全控制权,因此它可以在任何时候删除和修改wit/deps的内容!

交互式

使用wit-depswit-deps lock通过wit/deps.toml清单和wit/deps.lock(如果不存在则创建)来填充wit/deps

Rust

在项目的 build.rs 中使用 wit-deps::lock! 宏来自动锁定你的 wit/deps

查看crate文档以获取更多高级用法

设计决策

  • wit-deps 默认是懒加载的,只有在绝对需要时才会获取/写入
  • wit-deps 假设从URL获取的结果是确定的,即URL domain.com 的GET请求必须始终返回完全相同的内 容。注意,在这种情况下,你可以使用manifest条目中的 sha256sha512 字段来使缓存失效

依赖项

~20–34MB
~564K SLoC