@lutaml/opal-runtime
v1.0.1
Published
Pure Opal runtime for browser and Node.js. Shared by @unitsml/unitsml and other Opal-compiled gems so they don't each ship their own Opal runtime.
Downloads
257
Readme
@lutaml/opal-runtime
Pure Opal runtime, extracted from a real Opal compile. Shared by
@unitsml/unitsml and other Opal-compiled gems so a single
Opal global exists across the dependency tree.
Why
Every Opal-compiled gem ships a copy of the Opal runtime. If a user
installs two of them and loads both, two Opal globals fight for
the same name — silent memory bloat in Node, undefined behavior in
browsers.
A shared runtime package fixes this: each compiled gem declares
@lutaml/opal-runtime as a peer dep, every consumer gets one Opal
instance.
Usage (consumer)
// In an Opal-compiled gem's package.json
"peerDependencies": {
"@lutaml/opal-runtime": "^1.0.0"
},
"peerDependenciesMeta": {
"@lutaml/opal-runtime": { "optional": true }
}The peer is optional: if absent, a self-contained bundle (with embedded Opal) still works for CDN users. Bundler users with shared runtime get the smaller external flavor.
Build
scripts/build.js runs Opal::Builder.build("opal/runtime-stub")
and writes the resulting JS to dist/runtime.js. Single source of
truth — the runtime here is what @unitsml/unitsml compiles against.
Source of truth
Built from the latest released opal gem. Maintained by the lutaml
org.
