feat: WASMビルド完全対応+finiシステム修正 🎉

## WASMビルド対応
- TimerBox、AudioBox等の問題のあるBoxをWASM環境では条件付きコンパイルで除外
- WebBox (WebDisplayBox, WebConsoleBox, WebCanvasBox) にas_anyメソッド追加
- プラグイン関連コードに#[cfg]ガードを追加
- web-sysフィーチャーを追加(Performance、MouseEvent等)
- projects/nyash-wasmのビルドが完全に通るように!

## finiシステム修正
- フィールド差し替え時の自動fini削除(Nyashの明示的哲学に従う)
- スコープ離脱時のみfini実行(meは除外)
- ドキュメント更新で正しいfiniルールを明記

## その他
- CLAUDE.mdにWASMビルド方法を追記(wasm-pack build --target web)
- 開発サーバー起動方法を記載(python3 -m http.server 8010)
- cargo testで全テスト成功を確認

これでNyashがブラウザで動作可能に!🐱

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-20 07:33:18 +09:00
parent 83d3914e46
commit 670615d1de
18 changed files with 209 additions and 78 deletions

View File

@ -1,3 +1,6 @@
#[cfg(all(feature = "plugins", not(target_arch = "wasm32")))]
mod plugin_impl {
use crate::bid::{BidError, BidResult, LoadedPlugin};
use crate::bid::tlv::{TlvEncoder, TlvDecoder};
use crate::bid::types::BidTag;
@ -129,4 +132,9 @@ impl fmt::Display for GenericPluginBox {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.fmt_box(f)
}
}
}
} // mod plugin_impl
#[cfg(all(feature = "plugins", not(target_arch = "wasm32")))]
pub use plugin_impl::*;

View File

@ -1,4 +1,5 @@
use crate::bid::{BidError, BidResult, NyashHostVtable, NyashPluginInfo, PluginHandle, PLUGIN_ABI_SYMBOL, PLUGIN_INIT_SYMBOL, PLUGIN_INVOKE_SYMBOL, PLUGIN_SHUTDOWN_SYMBOL};
#[cfg(all(feature = "plugins", not(target_arch = "wasm32")))]
use libloading::{Library, Symbol};
use std::ffi::c_void;
use std::path::{Path, PathBuf};

View File

@ -8,6 +8,7 @@ pub mod metadata;
pub mod plugin_api;
pub mod bridge;
pub mod plugins;
#[cfg(all(feature = "plugins", not(target_arch = "wasm32")))]
pub mod loader;
// pub mod registry; // legacy - v2 plugin system uses BoxFactoryRegistry instead
// pub mod plugin_box; // legacy - FileBox専用実装
@ -19,6 +20,7 @@ pub use error::*;
pub use metadata::*;
pub use plugin_api::*;
pub use bridge::*;
#[cfg(all(feature = "plugins", not(target_arch = "wasm32")))]
pub use loader::*;
// pub use registry::*; // legacy - v2 plugin system uses BoxFactoryRegistry instead
// pub use plugin_box::*; // legacy