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
sourceSubpath
The path to the directory containing the module's source code, relative to the context directory.
contextDirectory
The module's context directory loaded into the engine (plus any generated code that may have been created).
dependencies
The dependencies of the module.
generatedContextDirectory
The generated files and directories made on top of the module source's context directory.
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

sourceSubpath: String!

The path to the directory containing the module's source code, relative to the context directory.

contextDirectory: Directory!

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

It holds the module's source code and every other file the engine loaded for the module, at their paths relative to the context root. Use sourceSubpath to locate the source code in it.

dependencies: [Module!]!

The dependencies of the module.

generatedContextDirectory: Directory!

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

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