Skip to main content

CurrentModule

The CurrentModule type provides capabilities to introspect the Dagger Function's module and interface between the current execution environment and the Dagger API.

API reference

Reflective module API provided to functions at runtime.

Implements Node

id
A unique identifier for this CurrentModule.
name
The name of the module being executed in
asSDK
Treat the currently executing module as an SDK installed in the active workspace, exposing the modules and clients it manages.
dependencies
The dependencies of the module.
generatedContextDirectory
The generated files and directories made on top of the module source's context directory.
generators
Return all generators defined by the module
source
The directory containing the module's source code loaded into the engine (plus any generated code that may have been created).
workdir
Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution.
workdirFile
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.

id: ID!

A unique identifier for this CurrentModule.

name: String!

The name of the module being executed in

asSDK: CurrentModuleAsSDK!

Treat the currently executing module as an SDK installed in the active workspace, exposing the modules and clients it manages.

Errors if the current module is not installed as an SDK in this workspace.

dependencies: [Module!]!

The dependencies of the module.

generatedContextDirectory: Directory!

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

generators(include: [String!]): GeneratorGroup!Experimental

Return all generators defined by the module

Experimental: This API is highly experimental and may be removed or replaced entirely.

include: [String!]

Only include generators matching the specified patterns

source: Directory!

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

workdir(path: String!,exclude: [String!] = [],include: [String!] = [],gitignore: Boolean = false): 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.

path: String!

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

exclude: [String!] = []

Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).

include: [String!] = []

Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).

gitignore: Boolean = false

Apply .gitignore filter rules inside the directory

workdirFile(path: String!): 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.

path: String!

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

References

Returned by