Skip to content

Step module

An EcmaScript Module (simply referred to as "Module") is a reusable piece of code that performs a specific task.

yaml
- _: Say hi
  log: Bonjour, mes amis !

module.source

The module source is the additional property of a Step that is not a reserved keyword.

It can be any scheme supported by the Deno runtime, such as:

  • file:/./// (local files)
  • http:/https: (remote files)
  • npm: (npm packages)
  • jsr: (packages from jsr.io)
yaml
- _: Local module
  steps:
    - ./my/relative/path/module.ts:
    - /my/absolute/path/module.ts:
    - file:///my/absolute/path/module.ts:

- _: Published modules
  steps:
    - npm:@esquie/example:
    - jsr:@esquie/example:
    - esquie/example: # alias for jsr:@esquie/example

- _: Remote modules
  steps:
    - https://esquie.app/example.ts:
    - https://raw.githubusercontent.com/esquie/example/main/mod.ts:

TIP

Unschemed sources are automatically prefixed with jsr:@ for convenience.

IMPORTANT

Esquie only supports at most one module per step. An error will be thrown at runtime if multiple modules are specified in the same step.

NOTE

A more explicit syntax is also supported, using the module.source property:

yaml
- _: Explicit module source syntax
  module:
    source: jsr:@esquie/example
    inputs: ~

Built-in modules

Several modules are bundled with the Esquie engine itself.

They use the special esquie: scheme and may have access to internal APIs and features not available to third-party modules, although they are still subject to the same security restrictions as any other module.

yaml
- _: Built-in modules
  steps:
    - esquie://log:
    - log: # alias for esquie://log

TIP

Built-in modules can be used without the esquie: scheme for convenience.

WARNING

Built-in modules are tightly coupled with the Esquie engine, and using a built-in module with a different version of Esquie is not officially supported.

Module versioning

Within an Expedition, different versions of the same module can be used together by specifying the version in the source (notably when using the jsr:/npm: schemes):

yaml
- _: Using multiple versions of the same module
  steps:
    - jsr:@esquie/example@1.0.0:
    - jsr:@esquie/example@2.0.0:

Several HTTP registries (such as esm.sh or jsDelivr) may also support versioning as well, but the syntax may vary from one registry to another.

This feature is particularly useful when a specific version of a module is required for compatibility reasons.

module.inputs

Most modules accept configuration options, also referred to as inputs.

The available inputs and formats depend on the module itself. See the respective module documentation for more details.

yaml
- _: Ask for a name
  id: name
  prompt:
    message: Comment tu t'appelles ?
    type: text

- _: Say hi
  log: Bonjour, ${esquie.steps.name.data} !

NOTE

A more explicit syntax is also supported, using the module.inputs property:

yaml
- _: Explicit module inputs syntax
  module:
    source: jsr:@esquie/example
    inputs: { foo: bar }

Released under the AGPL-3.0-or-later License.