# `Dagger.ModuleSource`
[🔗](https://github.com/dagger/dagger/blob/v0.20.5/sdk/elixir/lib/dagger/gen/module_source.ex#L2)

The source needed to load and run a module, along with any metadata about the source such as versions/urls/etc.

# `t`

```elixir
@type t() :: %Dagger.ModuleSource{client: term(), query_builder: term()}
```

# `as_module`

```elixir
@spec as_module(t()) :: Dagger.Module.t()
```

Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation

# `as_string`

```elixir
@spec as_string(t()) :: {:ok, String.t()} | {:error, term()}
```

A human readable ref string representation of this module source.

# `blueprint`

```elixir
@spec blueprint(t()) :: t()
```

The blueprint referenced by the module source.

# `clone_ref`

```elixir
@spec clone_ref(t()) :: {:ok, String.t()} | {:error, term()}
```

The ref to clone the root of the git repo from. Only valid for git sources.

# `commit`

```elixir
@spec commit(t()) :: {:ok, String.t()} | {:error, term()}
```

The resolved commit of the git repo this source points to.

# `config_clients`

```elixir
@spec config_clients(t()) :: {:ok, [Dagger.ModuleConfigClient.t()]} | {:error, term()}
```

The clients generated for the module.

# `config_exists`

```elixir
@spec config_exists(t()) :: {:ok, boolean()} | {:error, term()}
```

Whether an existing dagger.json for the module was found.

# `context_directory`

```elixir
@spec context_directory(t()) :: Dagger.Directory.t()
```

The full directory loaded for the module source, including the source code as a subdirectory.

# `dependencies`

```elixir
@spec dependencies(t()) :: {:ok, [t()]} | {:error, term()}
```

The dependencies of the module source.

# `digest`

```elixir
@spec digest(t()) :: {:ok, String.t()} | {:error, term()}
```

A content-hash of the module source. Module sources with the same digest will output the same generated context and convert into the same module instance.

# `directory`

```elixir
@spec directory(t(), String.t()) :: Dagger.Directory.t()
```

The directory containing the module configuration and source code (source code may be in a subdir).

# `engine_version`

```elixir
@spec engine_version(t()) :: {:ok, String.t()} | {:error, term()}
```

The engine version of the module.

# `generated_context_directory`

```elixir
@spec generated_context_directory(t()) :: Dagger.Directory.t()
```

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

# `html_repo_url`

```elixir
@spec html_repo_url(t()) :: {:ok, String.t()} | {:error, term()}
```

The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket).

# `html_url`

```elixir
@spec html_url(t()) :: {:ok, String.t()} | {:error, term()}
```

The URL to the source's git repo in a web browser. Only valid for git sources.

# `id`

```elixir
@spec id(t()) :: {:ok, Dagger.ModuleSourceID.t()} | {:error, term()}
```

A unique identifier for this ModuleSource.

# `introspection_schema_json`

```elixir
@spec introspection_schema_json(t()) :: Dagger.File.t()
```

The introspection schema JSON file for this module source.

This file represents the schema visible to the module's source code, including all core types and those from the dependencies.

Note: this is in the context of a module, so some core types may be hidden.

# `kind`

```elixir
@spec kind(t()) :: {:ok, Dagger.ModuleSourceKind.t()} | {:error, term()}
```

The kind of module source (currently local, git or dir).

# `local_context_directory_path`

```elixir
@spec local_context_directory_path(t()) :: {:ok, String.t()} | {:error, term()}
```

The full absolute path to the context directory on the caller's host filesystem that this module source is loaded from. Only valid for local module sources.

# `module_name`

```elixir
@spec module_name(t()) :: {:ok, String.t()} | {:error, term()}
```

The name of the module, including any setting via the withName API.

# `module_original_name`

```elixir
@spec module_original_name(t()) :: {:ok, String.t()} | {:error, term()}
```

The original name of the module as read from the module's dagger.json (or set for the first time with the withName API).

# `original_subpath`

```elixir
@spec original_subpath(t()) :: {:ok, String.t()} | {:error, term()}
```

The original subpath used when instantiating this module source, relative to the context directory.

# `pin`

```elixir
@spec pin(t()) :: {:ok, String.t()} | {:error, term()}
```

The pinned version of this module source.

# `repo_root_path`

```elixir
@spec repo_root_path(t()) :: {:ok, String.t()} | {:error, term()}
```

The import path corresponding to the root of the git repo this source points to. Only valid for git sources.

# `sdk`

```elixir
@spec sdk(t()) :: Dagger.SDKConfig.t() | nil
```

The SDK configuration of the module.

# `source_root_subpath`

```elixir
@spec source_root_subpath(t()) :: {:ok, String.t()} | {:error, term()}
```

The path, relative to the context directory, that contains the module's dagger.json.

# `source_subpath`

```elixir
@spec source_subpath(t()) :: {:ok, String.t()} | {:error, term()}
```

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

# `sync`

```elixir
@spec sync(t()) :: {:ok, t()} | {:error, term()}
```

Forces evaluation of the module source, including any loading into the engine and associated validation.

# `toolchains`

```elixir
@spec toolchains(t()) :: {:ok, [t()]} | {:error, term()}
```

The toolchains referenced by the module source.

# `user_defaults`

```elixir
@spec user_defaults(t()) :: Dagger.EnvFile.t()
```

User-defined defaults read from local .env files

# `version`

```elixir
@spec version(t()) :: {:ok, String.t()} | {:error, term()}
```

The specified version of the git repo this source points to.

# `with_blueprint`

```elixir
@spec with_blueprint(t(), t()) :: t()
```

Set a blueprint for the module source.

# `with_client`

```elixir
@spec with_client(t(), String.t(), String.t()) :: t()
```

Update the module source with a new client to generate.

# `with_dependencies`

```elixir
@spec with_dependencies(t(), [Dagger.ModuleSourceID.t()]) :: t()
```

Append the provided dependencies to the module source's dependency list.

# `with_engine_version`

```elixir
@spec with_engine_version(t(), String.t()) :: t()
```

Upgrade the engine version of the module to the given value.

# `with_experimental_features`

```elixir
@spec with_experimental_features(t(), [Dagger.ModuleSourceExperimentalFeature.t()]) ::
  t()
```

Enable the experimental features for the module source.

# `with_includes`

```elixir
@spec with_includes(t(), [String.t()]) :: t()
```

Update the module source with additional include patterns for files+directories from its context that are required for building it

# `with_name`

```elixir
@spec with_name(t(), String.t()) :: t()
```

Update the module source with a new name.

# `with_sdk`

```elixir
@spec with_sdk(t(), String.t()) :: t()
```

Update the module source with a new SDK.

# `with_source_subpath`

```elixir
@spec with_source_subpath(t(), String.t()) :: t()
```

Update the module source with a new source subpath.

# `with_toolchains`

```elixir
@spec with_toolchains(t(), [Dagger.ModuleSourceID.t()]) :: t()
```

Add toolchains to the module source.

# `with_update_blueprint`

```elixir
@spec with_update_blueprint(t()) :: t()
```

Update the blueprint module to the latest version.

# `with_update_dependencies`

```elixir
@spec with_update_dependencies(t(), [String.t()]) :: t()
```

Update one or more module dependencies.

# `with_update_toolchains`

```elixir
@spec with_update_toolchains(t(), [String.t()]) :: t()
```

Update one or more toolchains.

# `with_updated_clients`

```elixir
@spec with_updated_clients(t(), [String.t()]) :: t()
```

Update one or more clients.

# `without_blueprint`

```elixir
@spec without_blueprint(t()) :: t()
```

Remove the current blueprint from the module source.

# `without_client`

```elixir
@spec without_client(t(), String.t()) :: t()
```

Remove a client from the module source.

# `without_dependencies`

```elixir
@spec without_dependencies(t(), [String.t()]) :: t()
```

Remove the provided dependencies from the module source's dependency list.

# `without_experimental_features`

```elixir
@spec without_experimental_features(t(), [Dagger.ModuleSourceExperimentalFeature.t()]) ::
  t()
```

Disable experimental features for the module source.

# `without_toolchains`

```elixir
@spec without_toolchains(t(), [String.t()]) :: t()
```

Remove the provided toolchains from the module source.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
