Skip to main content

Class: CurrentModule

Reflective module API provided to functions at runtime.

Extends

  • BaseClient

Constructors

Constructor

new CurrentModule(ctx?, _id?, _name?): CurrentModule

Constructor is used for internal usage only, do not create object from it.

Parameters

ctx?

Context

_id?

ID

_name?

string

Returns

CurrentModule

Overrides

BaseClient.constructor

Methods

dependencies()

dependencies(): Promise<Module_[]>

The dependencies of the module.

Returns

Promise<Module_[]>


generatedContextDirectory()

generatedContextDirectory(): Directory

The generated files and directories made on top of the module source's context directory.

Returns

Directory


generators()

generators(opts?): GeneratorGroup

Experimental

Return all generators defined by the module

Parameters

opts?

CurrentModuleGeneratorsOpts

Returns

GeneratorGroup


id()

id(): Promise<ID>

A unique identifier for this CurrentModule.

Returns

Promise<ID>


name()

name(): Promise<string>

The name of the module being executed in

Returns

Promise<string>


source()

source(): Directory

The directory containing the module's source code loaded into the engine (plus any generated code that may have been created).

Returns

Directory


workdir()

workdir(path, opts?): Directory

Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution.

Parameters

path

string

Location of the directory to access (e.g., ".").

opts?

CurrentModuleWorkdirOpts

Returns

Directory


workdirFile()

workdirFile(path): File

Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.

Parameters

path

string

Location of the file to retrieve (e.g., "README.md").

Returns

File