github cue-lang/cue v0.8.0

latest releases: v0.9.2, v0.9.1, v0.10.0-0.dev...
3 months ago

This release includes experimental support for CUE Modules (more details below), as well as a number of improvements and fixes.

More CLs and refactors have also landed for the core evaluator's performance work. These aren't enabled yet as the work isn't complete; subscribe to the performance umbrella issue to read regular updates.

As a reminder: users can register their projects with Unity, our regression and performance testing setup. Unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working, or regress in terms of performance. It continues to catch multiple issues with each release. Adding your project to Unity not only guarantees that we will not break your tests (if we do, we will work with you to fix your CUE code), but it also helps to improve the quality of each CUE release. Follow this link to learn more about Unity, install it, or get in touch with any questions.

Modules

This release includes experimental support for CUE modules in cmd/cue, as outlined in the updated Modules and package management proposal v3.

Alongside this release, we have published a tutorial on the new website which shows how to publish and fetch modules with a custom module registry.

We have also published the first version of the Modules reference documentation, the canonical documentation page describing how CUE modules work in detail.

Note that support for CUE modules is still experimental and subject to change, and needs to be explicitly enabled via CUE_EXPERIMENT=modules. See cue help environment for more information on the environment variables used below.

CUE maps modules to registries via $CUE_REGISTRY, which supports a simple string configuration format as well as a more detailed CUE configuration format which can be read from disk. See cue help registryconfig for more details.

The new cue mod tidy command rewrites cue.mod/module.cue in its canonical format, adds any missing module dependency requirements, and removes unused ones.

The new cue mod publish command publishes the current module to a module registry.

The new cue mod get command can add a new module dependency, update an existing one, or downgrade an existing one as long as it does not cause any conflict.

When running commands like cue export with CUE_EXPERIMENT=modules, dependencies are automatically fetched from module registries following $CUE_REGISTRY and cached on disk inside $CUE_CACHE_DIR.

CUE Language Server Protocol Implementation

This release includes the first early version of an experimental Language Server Protocol (LSP) implementation for CUE. Whilst it remains experimental, the cmd/cuepls binary is separate from cmd/cue. However at a later date it will most likely to become a subcommand of cmd/cue like cue lsp serve.

We are working on updating the VSCode plugin to use cmd/cuepls, as well as supporting an initial version of a plugin for Neovim. For JetBrains users, we are working with the author of the CUE plugin to understand how best to integrate cmd/cuepls with JetBrains.

We will share announcements once the editor integrations are ready for use, and once more LSP features beyond formatting files are available. Subscribe to the LSP announce discussion, or join us in #cuepls on CUE Slack.

Go API

Note that this version of CUE requires Go 1.21 or later, following our policy to support the latest two stable Go releases just like upstream.

The cue/load package supports the CUE Modules experiment out of the box with the environment variable CUE_EXPERIMENT=modules. Alternatively, a custom registry and authorizer can be configured with the Config.Registry field via the modconfig.NewRegistry API.

cue/load also has a new Config.Env struct field to provide the environment variables used to load CUE modules from registries. It defaults to using os.Environ.

We have also added new Go examples to the cue/load package, including an example demonstrating the use of a CUE modules registry.

CL 1173271 drops support for legacy pkg directories, which have been deprecated since the transition to a cue.mod directory in 2019.

CL 1174069 replaces a few more uses of the deprecated cue.Instance type with cue.InstanceOrValue.

CL 1175779 deprecates the FileOffset and File.Base APIs in cue/token, which were inherited from go/token but never had any effect.

Language

There are no changes to the language in this version.

Spec

CL 1173197 makes the use of the term "builtin function" consistent across the document.

Core Evaluator

CL 1173262 fixes a regression introduced by v0.7.0's upgrade to github.com/cockroachdb/apd/v3 where some arithmetic operations would result in an extra 0 digit.

Encoders

CL 1173689 fixes the YAML encoder so that strings looking like hexadecimal numbers are properly quoted.

Builtins

CL 1173735 replaces the uses of Go's net package with net/netip when dealing with IP addresses, which makes them immutable, comparable, and take less memory.

CL 1173926 adds an IPv6 API to net to check that a value is a valid IPv6 address, mirroring IPv4 and taking advantage of the switch to the Go net/netip package.

CL 1174339 fixes tool/exec so that it correctly applies env defaults in CUE values.

CL 1174623 fixes tool/exec so that it accepts env list values as documented.

cmd/cue

CL 1176194 adds a language.version field to cue.mod/module.cue to track what CUE language version a module was written for. This will become necessary to make future language changes as smooth as possible for CUE users. For example, running cue mod init or cue mod tidy with the v0.8.0 release should add language: version: "v0.8.0" when the field isn't present.

CL 1173892 adds a cue help environment section to document the environment variables used by the CLI, such as CUE_EXPERIMENT and CUE_REGISTRY.

CL 1176665 fixes cue cmd so that legacy commands always get the corresponding CUE schema unified.

CL 1177330 fixes a bug where some evaluation errors in tools/flow and cue cmd were omitted, causing unintended results.

CL 1177546 tweaks cmd/cue so that it obeys the --package flag when the output format is CUE.

Full list of changes since v0.7.1

Don't miss a new cue release

NewReleases is sending notifications on new releases.