homura-runtime
Core Ruby + Module Worker glue for Opal on Cloudflare Workers. This gem does not depend on Sinatra or Sequel; those live in sibling gems.
What you get
require 'opal_patches'— additive patches for Opal corelib vs real-world gems (Rack, etc.).require 'cloudflare_workers'— Rack handler, Cloudflare bindings, multipart, queue, Durable Objects, etc.runtime/worker_module.mjs— fetch / scheduled / queue / DO adapters (no Opal bundle import).runtime/worker.mjs— thin bootstrap (crypto shim → bundle →worker_module) for legacy layouts.runtime/setup-node-crypto.mjs—node:cryptoonglobalThisbefore the Opal bundle loads.bin/cloudflare-workers-build— single build pipeline (ERB → assets → Opal → patch →worker.entrypoint.mjs). Use--standalonein generated apps.docs/ARCHITECTURE.md— wranglermain, codegen entrypoint, and fixed-import policy.
Quick start (homura monorepo)
Gemfile:gem 'homura-runtime', path: 'gems/homura-runtime'andgem 'opal-homura', '= 1.8.3.rc1', require: 'opal'(path or exact pin).bundle exec cloudflare-workers-build— writesbuild/hello.no-exit.mjsandbuild/worker.entrypoint.mjs.wrangler.toml:main = "build/worker.entrypoint.mjs",compatibility_flags = ["nodejs_compat"].
Support matrix (indicative)
| Component | Verified (dev) |
|---|---|
| Ruby | 3.4.x |
| Node | ≥ 20 |
| Wrangler | ^3.99 |
| Opal | = 1.8.3.rc1 |
Wrangler config
- Supported as generated / documented:
wrangler.tomlonly. wrangler.json/wrangler.jsonc: manual conversion only; not generated by this toolchain.
License
MIT. See the repository LICENSE.