Expand description
Script engines and script-only components.
jco componentize normally bakes one script into one JavaScript engine. This module supports
the alternative split: an engine component, built once from the union of the worlds its
scripts target, and script-only components that merely package a script’s source. At
runtime a host instantiates the engine, reads the script out of a script-only component and
hands it to the engine through jco:script-engine/script-loader.
The module does not run a JavaScript engine itself. engine_world produces the merged WIT
and a generated bootstrap module; the caller componentizes that module with ComponentizeJS or
componentize-qjs exactly as it would any other script. script_component packages a
bundled ES module as a component without any engine at all.
Structs§
- Engine
World - A merged engine world and the bootstrap module that implements it.
Construct custom values with
EngineWorld::builder. - Script
Component - A script to package as a script-only component.
Construct scripts with
ScriptComponent::builder. - WitInput
- A world that a script engine must support.
Construct inputs with
WitInput::builder.
Enums§
- Backend
- The JavaScript engine the bootstrap module will be componentized with.
Constants§
- ENGINE_
WORLD_ ID - Fully-qualified name of the world
engine_worldproduces. - ENGINE_
WORLD_ NAME - Name of the world
engine_worldproduces. - SCRIPT_
ENGINE_ WIT - WIT for
jco:script-engine, the loader interface every engine exports. - SCRIPT_
ONLY_ WORLD_ NAME - Name of the world script-only components export.
- SCRIPT_
WIT - WIT for
jco:script, the world script-only components export.
Functions§
- engine_
world - Build the engine world for
inputs. - script_
component - Package a script as a component exporting
jco:script/script.