Skip to content

Releases: 01mf02/jaq

1.5.1

07 Jul 11:20
Compare
Choose a tag to compare

This release reintroduces the @base64d filter that was accidentally removed in 1.5 (#192).
Furthermore, jaq now respects the NO_COLOR environment variable (#189).

Full Changelog: v1.5.0...v1.5.1

1.5

26 Jun 10:18
Compare
Choose a tag to compare
1.5

This release finishes the work started in jaq 1.4 towards making jaq being able to process non-JSON values. In particular, a vast majority the filters in jaq's core library can now process any kind of value that satisfies certain conditions; see the corresponding PR. Currently, this is mostly interesting for people who want to use jaq as an API.

Compilation errors

Since about two months, the compilation of jaq via cargo install jaq failed. This happened because a dependency of jaq called ariadne (responsible for printing compilation errors in jaq) broke semantic versioning. Unfortunately, despite the issue being known upstream, at the time of writing there has been no action towards resolving this problem. This put jaq in an awkward position and was somewhat ironic: the library responsible for reporting compilation errors caused compilation errors.

Eventually, I decided to resolve this problem by replacing ariadne. After having evaluated a number of alternative code span printing libraries, such as miette and codespan-reporting, I wrote a new library called codesnake. Starting from this release, codesnake is in charge for formatting code that is printed during compilation errors in jaq. One direct benefit of this change is that compilation errors are now also colored on the jaq playground.

At this point, I would like to thank @zesterer for having created and maintained ariadne. Without it, the error reporting in jaq would not be close to what it is today.

Smaller changes

This release corrects escaping of special characters in strings; in particular, newlines tabs, and quotes (") were not correctly escaped. For example, for the filter "\n" | tojson, jaq 1.4 yields "\"\n\"", whereas jaq 1.5 yields "\"\\n\"" (the difference being an additional backslash before n). Among others, this shows up in string interpolation ("\(.)"), tostring, and tojson.

Apart from ariadne, this release also removes another dependency, namely colored_json. This makes it possible to print output values without first converting them to a format that colored_json can interpret (serde_json::Value). This should favourably influence the performance of printing output values. In the long run, this will allow to remove jaq's dependency on serde, further contributing to shorter compilation times and smaller binary size.

Furthermore, when using --color never, compilation errors are now also printed without colors (#177).

Full Changelog: v1.4.0...v1.5.0

1.4

23 May 17:06
Compare
Choose a tag to compare
1.4

Work on this release has been sponsored by the NLnet foundation, to whom I would like to express my deep gratitude.

This release brings an exciting new addition: the jaq playground! Unlike its counterpart, the jq playground, the jaq playground runs jq filters on your computer and does not send data to a server to process it there. This makes it also suitable to run filters that yield an infinite number of outputs. For more details, see here.

The other big change is that when jaq is used as a library, you can now use it to process custom types of values. That makes it possible to adapt jaq to process non-JSON data, similarly to fq. See ValT for a description of the functions that every value type has to provide. (Thanks to @wader for providing feedback!)
In this version, the core and standard libraries of jaq (which provide named functions, such as length) still only provide functionality for JSON, but I plan to also change this in the future.

New features

  • New command-line options: --indent and --tab by @chutz #153
  • New filters: indices, index, and rindex by @kklingenberg #158 #165
  • Division of strings (string splitting) #167
  • Subtraction of arrays #164

Smaller changes

  • Fall back to regular file loading if memory mapping fails #168
  • More cleanly handle range(from; upto; 0) #170
  • Provide binary builds for aarch64-apple-darwin (Apple Silicon) by @amitksingh1490 #166
  • Make jaq-interpret tests pass on 32-bit platforms by @nekopsykose #159
  • Add Windows install (Scoop) instructions by @IndyV in #171

New Contributors

Full Changelog: v1.3.0...v1.4.0

1.3

22 Jan 16:41
Compare
Choose a tag to compare
1.3

This release makes jaq a lot lazier. In particular, several core filters, such as debug, are now evaluated as late as possible #131, and filters passed to path expressions are now also executed lazily #150. That means that many filters which did not terminate before now terminate!

Backwards-compatible additions

Thanks go especially to @kklingenberg for implementing several new functionalities!

  • Support for recursive object merging via a * b by @kklingenberg #130
  • Add env filter and $ENV variables by @kklingenberg #128
  • Extend path syntax to support paths like .a.[] #145
  • group_by terminates as soon as there is an error #129

Breaking Changes

  • The last(f) filter now returns no output instead of null when f yields no output. This is to make it consistent with first(f), which has the same behaviour. 51d3f51
  • Rename --compact to --compact-output to match jq #148
  • to_entries and paths now return objects without sorting keys, like jq 484dd27

Eliminated bugs

  • Calling jaq without a filter now correctly executes the identity filter #147
  • Calling jaq with an empty filter ('') now yields an error message instead of crashing, thanks to a new ariadne release --- thanks to @zesterer!
  • Processing long sequences with foreach used to crash with a stack overflow at the end, for example when executing foreach limit(1000000; repeat(1)) as $x (0; .+$x). This is now not longer the case. 854d22c

Full Changelog: v1.2.0...v1.3.0

1.2

17 Nov 12:41
Compare
Choose a tag to compare
1.2

jaq is a jq clone with an emphasis on correctness, speed, and simplicity.

This release brings initial support for tail-recursion optimisation. For example, the filter

def repeat(f): def rec: f, rec; rec; repeat(1)

yielded a stack overflow after several values in jaq before. Now, jaq will actually yield an infinite stream of ones.

As a result, several filters have been rewritten to leverage tail-recursion optimisation, in particular repeat and paths. The filters recurse, while, and until, which previously had to be implemented as native filters, are now implemented by definition, which significantly simplifies the code base.

Furthermore, a few filters are now executed more lazily, including array construction ([...]) and reduce/foreach/for. For example, the filters

def f: 1, [f]; limit(1; f)

and

def f: f; limit(1; foreach (0, f) as $x (1; .))

yielded a stack overflow in jaq before. Now, both just return 1, like jq.

Finally, as cherry on the icing, jaq now implements the range/3 filter and range/2 supports more maximal elements. For example, range(1; 10; 2) yields 1, 3, 5, 7, 9, and range(0; infinite) now yields the (infinite) stream of all natural numbers.

Full Changelog: v1.1.2...v1.2.0

1.1.2

06 Nov 06:42
Compare
Choose a tag to compare

Like jaq 1.1.1, this is a maintenance release without new features.
It decreases the minimal supported Rust version (MSRV) to allow building jaq on Rust versions as low as 1.64 (released Sept. 22, 2022).
Some parts of jaq, like the interpreter and the core library, now build even with Rust 1.63.

1.1.1

03 Nov 13:06
Compare
Choose a tag to compare

jaq 1.1 did not build on Rust 1.62 anymore due to some new versions of dependencies.
Therefore, jaq 1.1.1 downgrades a few dependencies so that it builds at least on Rust 1.65.
This is now automatically verified by a GitHub action.

Apart from this, this release contains no new functionality.

New Contributors

Full Changelog: v1.1.0...v1.1.1

1.1

31 Oct 11:59
Compare
Choose a tag to compare
1.1

jaq is a jq clone with an emphasis on correctness, speed, and simplicity.

The largest change in jaq 1.1 is the support for filter arguments in recursive filters. This means that you can now write something like:

def repeat(f): f, repeat(f); repeat(1, 2)

However, unlike in jq, this specific example will currently fail with a stack overflow after a certain number of values (about 12,000 on my machine). To address this issue, tail-call optimisation is necessary, which is planned to be supported in jaq 1.2.

Furthermore, several expressions that were evaluated strictly are now evaluated lazily, in particular cartesian products and objects.
That means that some filters that would previously never yield any input, now can yield an infinite number of inputs.

The API of jaq 1.1 is fully backwards compatible with the API of jaq 1.0.

Full Changelog: v1.0.0...v1.1.0

1.0

06 Oct 11:06
Compare
Choose a tag to compare
1.0

jaq is a jq clone with an emphasis on correctness, speed, and simplicity.

jaq 1.0 brings lots of features compared to the last stable release (0.10).
A short summary with examples:

  • Recursive/nested function definitions: def walk(f): def rec: (.[]? |= rec) | f; rec;
  • Variable arguments: def foo($v; f): ...
  • String interpolation: @uri "https://www.google.com/search?q=\(.search)"
  • if-then expressions without else branch: if . < 0 then - . end
  • try-catch expressions: try . * 10 catch "NaN"
  • Many, many new filters
  • Native filter API: allows you to create custom versions of jaq where you can supply your own filters written in Rust
  • Automatically built binaries

For more details on these changes, see the alpha, beta, and gamma release information.

Given that this is an 1.0 release, I will try to maintain a stable API.
Among others, future improvements that should be possible within the current API include optimisation of tail recursive calls (for better recursion performance) as well as parallel execution.

Thanks again to all contributors since the last stable release!

Full Changelog: v1.0.0-gamma...v1.0.0

1.0 gamma

04 Sep 09:21
Compare
Choose a tag to compare
1.0 gamma Pre-release
Pre-release

This release brings support for string interpolation, including custom formatters (thanks to @kklingenberg). That means that you can now write something like @uri "https://www.google.com/search?q=\(.search)" and have it interpreted like in jq.
Furthermore, like in the upcoming jq 1.7, else branches in if-then-else expressions can now be omitted.

This version is planned to be the last one before 1.0. No new features are supposed to be integrated into 1.0, only bug fixes.

From this release on, binaries are automatically built. It would be great if someone with an Apple system could test it on their machine.

Smaller changes

  • Remove --nul-output flag, following jq #108
  • Restore sub branching #110
  • Shrink error type #106

Full Changelog: v1.0.0-beta...v1.0.0-gamma