Step module
An EcmaScript module (simply referred to as module) is a reusable piece of code that performs a specific task.
- _: Say hi
log: Bonjour, mes amis !
module.source
The module source is defined by the first property of a step that is not one of the reserved keywords.
It may be any scheme supported by the Deno runtime, including but not limited to:
file:
(local files)npm:
(npm packages)jsr:
(packages from jsr.io)http:
/https:
(remote files)
- _: Local module
- ./my/relative/module.ts:
- /my/absolute/module.ts:
- file:///my/absolute/module.ts:
- _: Published modules
tasks:
- npm:@esquie/example:
- jsr:@esquie/example:
- _: Remote modules
tasks:
- https://esquie.app/example.ts:
- https://raw.githubusercontent.com/esquie/example/main/mod.ts:
Additionally, Esquie has special handling for its built-in modules, which can be referenced using only their name:
- _: Built-in modules
tasks:
- log:
- prompt:
TIP
Multiple versions of the same module can be used in a single expedition depending on the source.
- _: Using multiple versions of the same module
tasks:
- jsr:@esquie/example@1.0.0:
- jsr:@esquie/example@2.0.0:
This is particularly useful when a module has breaking changes between versions, or if a specific version is required for compatibility reasons.
CAUTION
Esquie only accepts a single module source per step. If multiple ones are detected, an error will be thrown at runtime.
module.inputs
The module inputs is the value of the module property itself. The structure of this value depends on the module being used.
- _: Ask for a name
id: name
prompt:
message: Comment tu t'appelles ?
type: text
- _: Say hi
log: Bonjour, ${esquie.steps.name.data} !