ExecutableScript
Executable Script
Defines the interface which executable scripts must comply with in order to be compatible with Elide's Guest VM layer and associated features. Executable scripts maintain an internal State describing their current point in the script execution lifecycle.
Elide doesn't care what language an executable script is written in, so long as it is described by a valid language descriptor (GuestLanguage) and supported by the guest VM. Each step in the script lifecycle is described below. See ancillary classes for more information.
Script Lifecycle
When a script is first created, it is initialized with a source target, language, and any relevant arguments, state, or environment. As applicable, Elide may elect to prepend or append content before evaluating user code (in order to produce a stable global environment). At this stage, the script is considered State.UNINITIALIZED.
Once the script has been assembled (linked), it is ready to be parsed/evaluated. At this stage, a VM is exclusively acquired to parse and evaluate the script, and, at the successful conclusion of this initial execution, it moves into the State.PARSED stage.
Parsed scripts are no longer executing from source, but still need to be interrogated for a proper entrypoint. After this stage completes, the script enters State.EVALUATED and is ready to be invoked. At this stage, the active VM is released back into the pool, and the executable script is ready.
At some point later (potentially immediately), the script is executed, which moves it into the State.EXECUTED stage terminally. The script remains in this stage for the duration of the server's lifecycle, and is re-executed from the cache for each invocation.
Sealed Interface
This interface is sealed to prevent direct external implementation; sub-classes are provided which describe common script loading strategies. The developer may opt to extend one of these sub-classes, where needed and supported.
See also
for the expected specification adhered to by guest language descriptors.
for an exhaustive enumeration of states that a script may inhabit during its lifecycle.
Inheritors
Types
Specifies the source code target for a guest VM script. This may be a file, a literal string, an embedded asset, or any other source permitted by the interface defined herein.
Specifies the type of code contained in a guest VM script, typically in the form of a MIME type; e.g. text/javascript
. Alternative symbols are provided as calculated properties from the underlying spec/
Specifies the source code map target for a guest VM script. This may be a file, a literal string, an embedded asset, or any other source permitted by the interface defined herein. This source map is expected to correspond with an associated ScriptSource.
Enumerates each state that an executable guest script may inhabit during its lifecycle. The process of these states is described in the main ExecutableScript docs.
Functions
Indicate the guest language that this script is written in; it is expected that the returned GuestLanguage is supported by the active VM, or no execution can take place.
TBD.
TBD.
TBD.