Skip to main content

Module script

Module script 

Source
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§

EngineWorld
A merged engine world and the bootstrap module that implements it. Construct custom values with EngineWorld::builder.
ScriptComponent
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_world produces.
ENGINE_WORLD_NAME
Name of the world engine_world produces.
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.