XiHan.Framework.Plugins.Wasm 5.0.0-preview.2

Prefix Reserved
This is a prerelease version of XiHan.Framework.Plugins.Wasm.
dotnet add package XiHan.Framework.Plugins.Wasm --version 5.0.0-preview.2
                    
NuGet\Install-Package XiHan.Framework.Plugins.Wasm -Version 5.0.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XiHan.Framework.Plugins.Wasm" Version="5.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.Plugins.Wasm" Version="5.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="XiHan.Framework.Plugins.Wasm" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XiHan.Framework.Plugins.Wasm --version 5.0.0-preview.2
                    
#r "nuget: XiHan.Framework.Plugins.Wasm, 5.0.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XiHan.Framework.Plugins.Wasm@5.0.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XiHan.Framework.Plugins.Wasm&version=5.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=XiHan.Framework.Plugins.Wasm&version=5.0.0-preview.2&prerelease
                    
Install as a Cake Tool

XiHan.Framework.Plugins.Wasm

关于

XiHan.Framework.Plugins.Wasm Wasm 插件宿主(实验性):插件是 WASI preview 1 的 reactor 模块,宿主用 wasmtime 在进程内沙箱里运行,限制内存、栈与 CPU 时间,没有网络,文件系统只有映射的目录。适合不受信任的插件,也是唯一支持插件贡献管道中间件的载体。

主要特性

  • 沙箱隔离:内存与栈上限、按时限强制中断
  • 插件可贡献管道中间件,运行期可加载与卸载
  • 陷阱或超时后自动退避重建实例

如何使用

安装

dotnet add package XiHan.Framework.Plugins.Wasm --prerelease

使用

注册特性并配置插件目录。Windows 上宿主可执行项目要关闭 CET 兼容,否则 wasmtime 的陷阱会让进程退出。

builder.AddXiHan(x => x
    .UseStandardProfile()
    .UseFeature<WasmPluginsFeature>());
<CETCompat>false</CETCompat>
{ "XiHan": { "Plugins": { "Wasm": { "Directories": ["plugins/echo-wasm"] } } } }

主要类型

此库提供的主要类型:

  • WasmPluginsFeature:特性入口
  • WasmPluginHost:实现 IPluginHost,Describe 返回诊断快照
  • WasmPluginOptions:目录、授予、挂载、资源上限与超时、重启策略

更多文档

相关包

反馈与贡献

XiHan.Framework.Plugins.Wasm 以 MIT 许可证 开源。欢迎到 GitHub 仓库 提交问题和贡献。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XiHan.Framework.Plugins.Wasm:

Package Downloads
XiHan.Framework.Plugins.Conformance

曦寒框架插件协议一致性测试套件

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0-preview.2 0 11/6/2026
5.0.0-preview.1 43 11/4/2026