---
slug: moon-v1.39
title: moon v1.39 - Improved task inputs, better proto integration, and project layers
authors: [milesj]
tags: [task, input, uri, object, proto, project, layer]
image: ./img/moon/v1.39.png
---

This is a rather small release, but it does include some important changes to task inputs, and
proto's integration.

<!--truncate-->

## Improved task inputs

A few months ago we introduced an
[RFC for improving task inputs](https://github.com/moonrepo/moon/issues/1985) that introduces new
syntax, functionality, and input types. In this release, we have implemented a portion of the RFC
for testing before we implement the rest. Continue reading for more details!

### New formats

To start, we are introducing 2 new formats for configuring task inputs, a URI format and an object
format, both of which support custom parameters.

#### URIs

URIs should be rather familiar, as they are a string prefixed with a scheme (`://`), followed by a
value, and an optional list of query parameters (`?`). Currently files can be specified using the
[`file://` scheme](/docs/config/project#file-paths), and globs with the
[`glob://` scheme](/docs/config/project#glob-patterns). Environment variables do not support URIs.

```yml title="moon.yml"
tasks:
  build:
    # ...
    inputs:
      - 'file:///*.config.js?optional'
      - 'glob://src/**/*.ts'
```

:::info

Files and globs can still be configured using literal strings. The URI format can be used when
customizing parameters!

:::

#### Objects

Objects provide an alternative to strings, allowing you to customize parameters in a standard and
familiar format. Files can be specified using the [`file` key](/docs/config/project#file-paths), and
globs with the [`glob` key](/docs/config/project#glob-patterns). Environment variables do not
support objects.

```yml title="moon.yml"
tasks:
  build:
    # ...
    inputs:
      - file: '/*.config.js'
        optional: true
      - glob: 'src/**/*.ts'
```

### New parameters

As mentioned above, file and glob inputs now support parameters, which can be customized using URI
and object formats. The following parameters are available:

#### Files

- `content` (`string`) - When determining affected state, will match against the file's content
  using the defined regex pattern, instead of relying on file existence.
- `optional` (`boolean`) - When hashing and set to `true` and the file is missing, will not log a
  warning. When set to `false` and the file is missing, will fail with an error. Defaults to logging
  a warning.

#### Globs

- `cache` (`boolean`) - When gathering inputs for hashing, defines whether the glob results should
  be cached for the duration of the moon process. Defaults to `true`.

## Better proto integration

In previous versions of moon, we would automatically install [proto](/proto) for you based on
certain conditions. This logic was applied to all `moon` sub-commands, which was not necessary, as
it was only required for task running related commands.

To improve this, we have integrated proto into the action pipeline through a new action,
`SetupProto`, which runs before any `SetupToolchain` action. With this, proto is only installed when
required by that specific toolchain, and not for every command.

### New `proto` setting

Additionally, we are introducing a [`proto`](/docs/config/toolchain#proto) setting in
[`.moon/toolchain.yml`](/docs/config/toolchain), which can be used to control the integration of
proto in moon. To start, you can now customize the proto version! This is extremely useful if you
want to test new proto features, or need to rollback to an older version.

```yml title=".moon/toolchain.yml"
proto:
  version: '0.51.4'
```

### Other changes

Lastly, proto has been upgrade to [v0.51](https://github.com/moonrepo/proto/releases/tag/v0.51.0),
which includes 2 major features: lockfiles and custom registries. However, we have yet to test these
features thoroughly in moon, so they are not "officially" supported yet, but you can still use them
if you wish. We will be adding support for these features in the future.

## Project layers

Project layers may sound like a new feature, but they are simply a rename of the project type. Going
forward, the `type` setting in [`moon.yml`](/docs/config/project) has been renamed to
[`layer`](/docs/config/project#layer), but backwards compatibility will be maintained until v2. Why
the rename?

The term "layer" better reflects the purpose and functionality of this concept, as it defines a
layer (the [`layer`](/docs/config/project#layer) setting) within the development stack (the
[`stack`](/docs/config/project#stack) setting), and helps to enforce proper relationships. This
change aims to improve clarity and consistency in our configuration.

For example, the following layers are available, from highest to lowest. Layers can then depend on
lower layers, but not higher layers. Except for automations and applications, they can also depend
on themself.

| Layer           | Description                                                         |
| --------------- | ------------------------------------------------------------------- |
| `automation`    | An automated testing suite, like E2E, integration, or visual tests. |
| `application`   | An application of any kind.                                         |
| `tool`          | An internal tool, CLI, one-off script, etc.                         |
| `library`       | A self-contained, shareable, and publishable set of code.           |
| `scaffolding`   | Templates or generators for scaffolding.                            |
| `configuration` | Configuration files or infrastructure.                              |
| `unknown`       | When not configured.                                                |

Because of this rename, the following changes have been made:

- `type` --> `layer` in `moon.yml`
- `--type` --> `--layer` in `moon query projects`
- `projectType` --> `projectLayer` for MQL
- `$projectType` --> `$projectLayer` for task tokens
- `enforceProjectTypeRelationships` --> `enforceLayerRelationships` in `.moon/workspace.yml`

## Other changes

View the [official release](https://github.com/moonrepo/moon/releases/tag/v1.39.0) for a full list
of changes.

- Added unstable support for bubbling up logs from WASM plugins.
- Updated the `@moonrepo/cli` npm package to no longer rely on postinstall scripts.
- Improved argument quoting for commands and scripts.

## What's next?

With toolchains plugins being stabilized more, we'd like to focus on some other areas.

- Better command line argument parsing/joining (especially for task `args`)
- Pkl configuration improvements
- WASM toolchain documentation
