// u6u-builtins Worker // 所有零件已遷移至 u6u-core/registry/components/ 的 TinyGo .wasm 版本 // 此 Worker 保留 /init 端點供初始化 Component Registry 使用 import { Hono } from 'hono'; import { cors } from 'hono/cors'; import type { Bindings } from './types'; import { initComponents } from './actions/initComponents'; const app = new Hono<{ Bindings: Bindings }>(); app.use('*', cors()); app.get('/', c => c.json({ service: 'u6u-builtins', version: '2.0.0', status: 'ok', note: '所有零件已遷移至 WASM,請使用 Component Registry', })); // POST /init — 把所有零件上架到 Component Registry(冪等,可重複執行) app.post('/init', async c => { const result = await initComponents(c.env); const allOk = result.failed === 0; return c.json({ success: allOk, ...result }, allOk ? 200 : 207); }); export default app;