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.
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.
// 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.
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.
Built from the latest released opal gem. Maintained by the lutaml
org.