phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0

This commit is contained in:
nyash-codex
2025-11-06 15:41:52 +09:00
parent 2dc370223d
commit 77d4fd72b3
1658 changed files with 6288 additions and 2612 deletions

View File

@ -56,7 +56,7 @@ impl eframe::App for NyashBrowser {
ui.text_edit_singleline(&mut self.url);
if ui.button("Go").clicked() {
// Nyashファイル実行
if self.url.ends_with(".nyash") {
if self.url.ends_with(".hako") {
self.content = execute_nyash(&self.url);
}
}
@ -78,7 +78,7 @@ impl eframe::App for NyashBrowser {
// Tauriコマンドでブラウザ機能実装
#[tauri::command]
async fn browse_nyash(url: String) -> Result<BrowseResult, String> {
if url.ends_with(".nyash") {
if url.ends_with(".hako") {
// Nyash VMで直接実行
let vm = NyashVM::new();
let result = vm.execute_file(&url)?;
@ -158,7 +158,7 @@ box SharedMemoryRenderer {
```nyash
box DevServer from FileWatcherBox {
watchAndReload(directory) {
me.watch(directory, "*.nyash", (file) => {
me.watch(directory, "*.hako", (file) => {
// 変更を検出したら即座にリコンパイル
local compiled = me.compiler.compileWithSourceMap(file)
@ -231,7 +231,7 @@ box CollaborativeEditor from P2PBox {
- [ ] Nyash VM統合
### Week 2: コア機能
- [ ] .nyashファイル実行
- [ ] .hakoファイル実行
- [ ] JIT/AOTコンパイル統合
- [ ] 基本的なセキュリティ

View File

@ -14,15 +14,15 @@ Nyashでブラウザーを作り、ネイティブ実行する構想について
{
"name": "Nyash Browser Extension",
"permissions": ["webRequest", "webRequestBlocking", "nativeMessaging"],
"host_permissions": ["*://*/*.nyash"]
"host_permissions": ["*://*/*.hako"]
}
// background.js
chrome.webRequest.onBeforeRequest.addListener(
(details) => {
if (details.url.endsWith('.nyash')) {
if (details.url.endsWith('.hako')) {
// Native hostと通信してNyash VMで実行
chrome.runtime.sendNativeMessage('com.nyash.runtime',
chrome.runtime.sendNativeMessage('com.hako.runtime',
{ command: 'execute', url: details.url },
(response) => {
// 結果を新しいタブで表示
@ -99,8 +99,8 @@ async fn execute_nyash(window: Window, code: String) -> Result<Value, String> {
fn nyash_protocol_handler(app: &AppHandle, request: &Request) -> Response {
let path = request.uri().path();
// .nyashファイルを実行
if path.ends_with(".nyash") {
// .hakoファイルを実行
if path.ends_with(".hako") {
let code = std::fs::read_to_string(path).unwrap();
let vm = VM::new();
let result = vm.execute(&code).unwrap();
@ -124,7 +124,7 @@ fn nyash_protocol_handler(app: &AppHandle, request: &Request) -> Response {
#### 1. カスタムHTMLエレメント
```html
<!-- Nyashコードを直接HTMLに埋め込み -->
<nyash-app src="todo-app.nyash">
<nyash-app src="todo-app.hako">
<template>
<div class="todo-list">
<nyash-for items="todos" as="todo">
@ -423,7 +423,7 @@ impl eframe::App for NyashBrowser {
2. **Week 2**: カスタムプロトコル
- nyash://プロトコルハンドラー
- .nyashファイル実行
- .hakoファイル実行
- 結果表示
3. **Week 3**: 高速化

View File

@ -18,9 +18,9 @@
```javascript
// Chrome拡張機能側
chrome.webNavigation.onBeforeNavigate.addListener((details) => {
if (details.url.endsWith('.nyash')) {
if (details.url.endsWith('.hako')) {
// Native Messagingでローカルプロセスと通信
chrome.runtime.sendNativeMessage('com.nyash.executor',
chrome.runtime.sendNativeMessage('com.hako.executor',
{ action: 'execute', url: details.url },
(response) => {
// 実行結果をタブに表示
@ -109,7 +109,7 @@ box NyashBrowser from TauriBox {
init { apps, vm, cache }
navigateTo(url) {
if url.endsWith(".nyash") {
if url.endsWith(".hako") {
// ローカルキャッシュチェック
local app = me.cache.get(url)
if !app {
@ -216,7 +216,7 @@ let wasi_env = WasiEnv::builder("nyash-app")
```nyash
box DevServer {
watch(directory) {
me.fs.watchFiles(directory, "*.nyash", (file) => {
me.fs.watchFiles(directory, "*.hako", (file) => {
me.recompile(file)
me.browser.reload()
me.notify("Reloaded: " + file)