github cue-lang/cue v0.13.0-alpha.1

pre-releaseone day ago

This release brings a new cue trim algorithm, a performance fix for field ordering, two new commands, and many fixes.

Changes which may break some users are marked below with: ⚠️

Evaluator

A great deal of work has happened in the new evaluator, which can be used via CUE_EXPERIMENT=evalv3. Marcel recently posted another update on performance progress.

An entirely new algorithm for cue trim and tools/trim has been implemented for CUE_EXPERIMENT=evalv3, which resolves all known bugs when trimming CUE. Give it a try and report any issues you find.

⚠️ The new topological sort algorithm for field ordering has been tweaked to avoid becoming too slow in some cases. This may result in some ordering changes, but we expect them to be relatively small. See the change for more details.

The parser now correctly allows keywords as required field labels such as if!: _, fixing a discrepancy with the spec.

cmd/cue

The new cue refactor imports command rewrites import paths, making it easy to migrate between module locations and major versions.

The new cue mod mirror command copies modules from one registry to another.

cue get go should no longer attempt to import types from the Go standard library as CUE, which caused errors.

Hidden files and files with build tags should now be correctly filtered when loading a single CUE package.

Encodings

Loading binary files, such as via @embed(file="foo", type=binary), no longer requires the input to be valid UTF-8.

⚠️ The JSON Schema decoder now imports schema descriptions as CUE doc comments, which required a change to encoding/jsonschema.Config.DefineSchema.

Go API

⚠️ The long-deprecated cue.Runtime methods Parse, FromExpr, CompileFile, and CompileExpr are now removed.

module.SplitPathVersion and module.ParseImportPath have been deprecated in favor of cue/ast.SplitPackageVersion and cue/ast.ParseImportPath package to consolidate the API.

The new mod/module.Version.Compare method is added in favor of module.Sort, which is now deprecated.

The new mod/modfile.File.ModuleForImportPath function allows resolving a module and default major version for a package without consulting a registry.

The new mod/modregistry.Client.Mirror method implements the logic behind the new cue mod mirror command.

Full list of changes since v0.12.0
  • encoding/jsonschema: support x-kubernetes-embedded-resource by @rogpeppe in 0cd0a0c
  • encoding/jsonschema: initial support for Kubernetes CRDs by @rogpeppe in 0dcaff5
  • cmd/cue: mention --inject-vars/-T flag for injection help by @myitcv in 90c1965
  • cue/load: respect build tags when determining package by @rogpeppe in 58e09ee
  • internal/mod/modimports: exclude hidden CUE files by @rogpeppe in 8f2c89c
  • cmd/cue, internal/mod/modimports: add test cases for issue 3795 by @rogpeppe in 2742aba
  • cue/load: use iterator range by @rogpeppe in 9ba4189
  • mod/module: add Version.Compare by @mvdan in 931fecb
  • all: start making more use of strings.Cut by @mvdan in 7d62514
  • all: unconvert -apply ./... by @mvdan in cbed854
  • internal/ci: update Go and goreleaser by @mvdan in bebbaa9
  • core/toposort: stop trying to order structinfos/structlits by @cuematthew in bc6c485
  • internal/cuetxtar: Append \n to generated txtar file content by @cuematthew in 5d2da07
  • cmd/cue: adjust the detection of Go standard library packages by @mvdan in 153fc8a
  • cmd/cue: actually drop unsupported Go std types in get go by @mvdan in 97cbf7e
  • cmd/cue: add testscript reproducing get go issues with std packages by @mvdan in 9a53c81
  • internal/_e2e: remove unused CUE_REGISTRY_TOKEN env var by @mvdan in 239f3d3
  • encoding/jsonschema: delete code for Go 1.22 by @mvdan in 24e90ed
  • update golang.org/x dependencies by @mvdan in b6618cc
  • update various dependencies unlikely to cause breakage by @mvdan in 66f9e79
  • all: use a few more newer std APIs by @mvdan in 538fb69
  • core/toposort: Do not calculate cycles within an SCC by @cuematthew in d73e690
  • cue/parser: allow if as a label for a required field by @haoqixu in 18367a6
  • encoding/jsonschema: support single schema not at root by @rogpeppe in cdc4123
  • cmd/cue: fix refactor imports over multiple modules by @rogpeppe in 7cc1de3
  • cue.mod: use exp3 curated modules by @myitcv in fca4a5f
  • internal/core/adt: fix counter issue by @mpvl in a0c6dfe
  • internal/core/adt: fix edge case in structural cycles with structure sharing by @mpvl in 966a504
  • internal/core/adt: fix structural cycle stack overflow by @mpvl in a66eaf3
  • internal/core/adt: remove Inline check by @mpvl in 7bb676e
  • internal/core/adt: make inline expressions addressable by @mpvl in 35ec59b
  • encoding/openapi: convert remaining cue->json tests to txtar by @cuematthew in ba1084a
  • encoding/openapi: convert test suite to txtar by @cuematthew in 374c59e
  • internal/core/adt: do not hasNonCycle in one case by @mpvl in 52c02d0
  • internal/core/adt: refactor unifyNode by @mpvl in e55c7a8
  • internal/core/adt: add tests for issue 3634 by @mpvl in 8ed768a
  • internal/encoding: don't interpret files as UTF8 with the binary encoding by @nichtsundniemand in 0b36c4e
  • cue/interpreter/embed: remove obsolete TODOs by @mvdan in 8585568
  • cmd/cue/cmd: show incorrect handling of binary files when embedded by @nichtsundniemand in 073d23c
  • encoding/jsonschema: pass comments to DefineSchema by @rogpeppe in 880023b
  • Revert "encoding/jsonschema: pass comments to DefineSchema" by @mvdan in b6f250e
  • internal/core/adt: propagate default marker in single nested value by @mpvl in 26a698f
  • cmd/cue: stop marking the login command as experimental by @mvdan in 324b3da
  • internal/core/adt: add tests for issue 3779 by @mpvl in 8b80c3d
  • cmd/cue: embed support is no longer experimental by @mvdan in dce7fda
  • encoding/jsonschema: pass comments to DefineSchema by @rogpeppe in 7a3708e
  • cue/parser: allow for as label for required field by @haoqixu in fc8791f
  • mod/modregistrytest: move from internal/registrytest by @mvdan in b14cfde
  • internal/core/adt: fix FromDef by @mpvl in df327a6
  • cmd/cue/cmd: add test for edge case by @mpvl in 587d5a1
  • internal/core/adt: shorten closeContext graph depth by @mpvl in b17ea50
  • all: start using slices.Backward by @mvdan in 66d4c35
  • internal/vcs: use os.CopyFS from Go 1.23 by @mvdan in 873afd5
  • cue: tweak cue.Value.Decode with Go std changes by @mvdan in 4e0cc47
  • internal/core/adt: remove unnecessary clearing of CloseInfo by @mpvl in 3ed6d8d
  • internal/core/adt: hoist feature checking logic by @mpvl in ae5a017
  • internal/core/adt: do not add arc dependencies for some nodes by @mpvl in 98a3f93
  • internal/core/adt: prepare for shortening root by @mpvl in 58b3e7d
  • internal/core/adt: add test for closeContext graph shortening by @mpvl in 0d33c2e
  • internal/core/adt: simplify ellipsis logic by @mpvl in 694d295
  • internal/core/adt: fix bug when merging closing struct with ellipsis by @mpvl in 7822519
  • internal/core/adt: add test for issue 3778 by @mpvl in df049c8
  • all: use more maps and slices APIs from Go 1.23 by @mvdan in 6a00a13
  • core/adt: correct copying of conjuncts in stripNonDefaults by @cuematthew in 15a702e
  • cmd/cue: don't truncate refactor-imports help text by @jpluscplusm in 9413ce6
  • encoding/jsonschema: better placement of jsonschema attribute by @rogpeppe in 09effdb
  • internal/core/adt: bring semantics of top in line with v2 by @mpvl in 9601805
  • tools/trim: implement trim for evalv3 by @cuematthew in e3d44f0
  • tools/trim: prepare for trimv3 by @cuematthew in 13fdb81
  • encoding/jsonschema: add test case for if/then/else with $id by @rogpeppe in 29be366
  • all: GODEBUG=gotypesalias=1 is on as of go1.23.0 by @mvdan in 0eeb982
  • all: start using maps and slices APIs from Go 1.23 by @mvdan in b343839
  • internal/core/adt: fix yield unwinding issue for validators by @mpvl in 34ab133
  • internal/core/adt: add tests for 3762 by @mpvl in 71edb90
  • internal/core/adt: fix consistency issue for disjunctions by @mpvl in bb1be01
  • internal/core/adt: add tests for 3124 by @mpvl in 53fbe1e
  • internal/core/adt: remove diff/todo/p1 by @mpvl in a1be113
  • internal/core/adt: improve reference cycle behavior by @mpvl in 67886c6
  • internal/core/adt: explicitly detect cycle error by @mpvl in 4350436
  • internal/core/adt: put blocking queue on stack by @mpvl in 313b62f
  • internal/core/adt: add tests for 3669 and 3737 by @mpvl in 18a0661
  • internal/core/adt: disable nodeContext.free by @mpvl in 93d4e38
  • internal/core/adt: prune recursive processing by @mpvl in d8d19aa
  • internal/core/adt: remove noop counter by @mpvl in 3390dea
  • internal/core/adt: logging improvements by @mpvl in 7b03078
  • cmd/cue: update workflow command help text links by @jpluscplusm in 3545df1
  • cmd/cue: improve CUE example for exp-gengotypes by @jpluscplusm in 8d8a36d
  • require Go 1.23 or later, test and release with Go 1.24 by @mvdan in 1a8c16d
  • cue/testdata: add a benchmark test for https://cuelang.org/issue/3514 by @myitcv in d12c8be
  • internal/core/adt: pass and use OpContext to functions using Schema by @mpvl in f1d39f0
  • pkg: use adt.Unify instead of Value.Unify by @mpvl in b71b8c0
  • internal/encoding/yaml: use adt.Unify instead of Value.Unify by @mpvl in c9c8cb4
  • internal/core/adt: avoid crash by @mpvl in 11be031
  • internal/core/adt: move cycle state saving logic to Expr by @mpvl in 3e021be
  • internal/value: support more types and rename ConvertToContext by @mpvl in 96d9f6f
  • all: use eval.NewContext when possible by @mpvl in f4da7a3
  • internal/core/adt: add Expr method on CallContext by @mpvl in ee11854
  • cmd/cue: mention -c=false in vet's incomplete error by @jpluscplusm in 6fb2a9b
  • internal/core/adt: recursively resolve pending arcs before lookup by @mpvl in 8d01019
  • internal/core/adt: add test for issue 3708 by @mpvl in 7bfa238
  • cmd/cue: add experimental warning to gengotypes by @jpluscplusm in f0ed173
  • internal/core/adt: remove GroupUnify mechanism by @mpvl in ab1e2d9
  • internal/core/adt: do not carry forward FromEmbed by @mpvl in 455b96b
  • internal/core/adt: do not carry forward FromDef flag by @mpvl in 3d57eed
  • internal/core/adt: use adt.Unify in cue package by @mpvl in dd9e48f
  • encoding/openapi: swap sort.Slice for slices.Sort by @mvdan in 1d7f66f
  • encoding/jsonschema: use a cmp-based stable sort when decoding constraints by @mvdan in db72890
  • internal/envflag: small follow-ups to int and string support by @mvdan in e6fec6b
  • internal/core/adt: fix handling of top by @mpvl in 433e3c3
  • cue: add tests for Unify by @mpvl in b582d7f
  • internal/envflag: support int and string flags by @mvdan in 0e42b0b
  • internal/envflag: skip over empty comma-separated elements by @mvdan in 62ea127
  • cmd/cue: implement mod mirror by @rogpeppe in 7d7abff
  • mod/modregistry: add Mirror by @rogpeppe in 5d7cdbb
  • all: use ast.ParseImportPath and ast.ImportPath by @rogpeppe in d5ab208
  • cmd/cue: add refactor imports command by @rogpeppe in 8dbff63
  • cue/ast: properly deprecate Optional and Token in Fields by @mvdan in 0265d7d
  • update emicklei/proto and protocolbuffers/txtpbfmt by @mvdan in 2781759
  • cue: remove more long-deprecated APIs by @mvdan in 2c86de5
  • cmd/cue: fix typos in cue-help-filetypes by @jpluscplusm in 0a43336
  • internal/core/adt: pass CallContext to builtin functions by @mpvl in 5991735
  • core/adt: Combine Vertex.Structs when inserting Conjunct for evalv3 by @cuematthew in 2d65404
  • ast/astutil: make Resolve aware of version suffixes by @rogpeppe in 6a125a9
  • cue.mod: upgrade to latest GitHub actions curated module by @myitcv in 802d7f4
  • ast/astutil: add test for resolving imports with major version suffix by @rogpeppe in 5ab4551
  • mod/modfile: add ModuleForImportPath by @rogpeppe in b684a52
  • mod/modfile: make it an error to have an empty module path by @rogpeppe in c269767
  • mod/module: add explicit test for package path with full version by @rogpeppe in 24cf1f8
  • internal/core/adt: first step in using CallContext by @mpvl in 5886c49
  • internal/core/adt: fix hang on finalization by @mpvl in d4d20b6
  • pkg/encoding/json: expand implementation of Validate in place by @mpvl in 87db94f
  • internal/core/adt: prevent recursion in calls by @mpvl in 16e3250
  • internal/core/adt: do not count validators as new data by @mpvl in 5b4a02e
  • internal/core/adt: fix some cycle issues related to validators by @mpvl in 36174e5
  • pkg/encoding/yaml: hoist validate functionality by @mpvl in dc3e807
  • internal/core/adt: set the parent in UnifyValidator by @mpvl in 0eb0235
  • internal/core/adt: hoist unifyValidator by @mpvl in 7fd7f6d
  • internal/core/adt: avoid cycle in debug output by @mpvl in bd087f6
  • internal/core/adt: add tests for 3649 by @mpvl in c63ed21
  • internal/core/adt: add more error context in matchN by @mpvl in 950a30f
  • internal/cmd/cue-ast: add support for ref and file-only by @rogpeppe in 809299a
  • internal/cueversion: bump LanguageVersion for v0.13 by @mvdan in 8a94279

Don't miss a new cue release

NewReleases is sending notifications on new releases.