pub const SCRIPT_ENGINE_WIT: &str = "package jco:script-engine@0.1.0;\n\n/// Loads JavaScript into a Jco script engine component at runtime.\n///\n/// A script engine is a JavaScript engine (StarlingMonkey or QuickJS) componentized\n/// against the union of the worlds its scripts target. Its world exports forward to\n/// whichever script is currently loaded, so one engine instance can run scripts one\n/// after the other. Scripts loaded into the same engine instance share a JavaScript\n/// realm, so this is not a multi-tenancy boundary.\ninterface script-loader {\n /// Evaluate `source` and make its exports the implementation behind the engine\'s\n /// world exports, replacing any previously loaded script.\n ///\n /// `source` is an ES module as packaged by `jco componentize --script-only`: imports\n /// hoisted to the top, one export list at the end, and no top-level await. It may import\n /// any import of the engine world by its WIT specifier.\n load: func(name: string, source: string) -> result<_, string>;\n\n /// Drop the loaded script. World exports fail until another script is loaded.\n unload: func();\n\n /// Name of the loaded script, if any.\n loaded: func() -> option<string>;\n}\n\n/// The world every script engine exports, in addition to the merged script worlds.\nworld engine {\n export script-loader;\n}\n";Expand description
WIT for jco:script-engine, the loader interface every engine exports.