Jsonnet

Latest version: v0.20.0

Safety actively analyzes 682387 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 7

0.20.0

Bug fix

This release has a bug fix for `std.member` on strings (https://github.com/google/go-jsonnet/issues/656)


Standard library additions

- `std.escapeStringXML`
- `std.sum`
- `std.xor`
- `std.xnor`
- `std.isEmpty`
- `std.round`
- `std.objectKeysValues` (convert an object to a list of pairs)
- `std.objectKeysValuesAll`


jsonnet-go specific updates:

jsonnet-deps and jsonnet-lint are now included in releases

0.19.2pre2

This is a special pre-release intended to test new build settings.

0.19.2pre1

This is a special pre-release intended to test new build settings.

0.19.1

The previous v0.19.0 release had a small change in the C bindings to allow `importbin` to function, but missing from the release notes was mention of the fact that the Python bindings had also changed in a similar way - to require the content of the file to be provided as a `bytes` type instead of a `str`. To convert from `str` to `bytes`, simply call `.encode()` on the `str`.

In order to write Python code that works for both Jsonnet versions, the Jsonnet version is now provided as a field of the _jsonnet module, which allows writing code like the following:


import _jsonnet
import semver

import_returns_bytes = semver.compare(getattr(_jsonnet, 'version', 'v0.18.0')[1:], '0.18.0') > 0

def no_nl_eof(directory, rel):
if import_returns_bytes:
return "foo.jsonnet", b"42"
else:
return "foo.jsonnet", "42"

_jsonnet.evaluate_snippet("test.jsonnet", "{\nlocal foo = import 'foo.jsonnet',\n \n 'bar': foo\n }\n", import_callback=no_nl_eof)


This release also fixes an off-by-one truncation error in the import callback logic of the Python bindings introduced in the previous release. This was only noticeable if the imported file had no trailing \n, or if you were using `importbin` with a Python import callback.

0.19.0

Language

- importbin feature for loading binary files

Tooling

- In order to support importbin, it was necessary to change the C API for import callbacks so that
they can return arbitrary binary blobs (that can contain \0) as opposed to just strings. This
change is not binary compatible with previous versions of libjsonnet. If you build against
libjsonnet.h and you use import callbacks then you will have to make a small adjustment to your
code.

- The emscripten build rules are now gone.
- Fixed memory leak in libjsonnet++.cpp
- Fixed lack of jsonnet_realloc in Go C bindings

- There are many more native implementations of library functions on the Go side, resulting in better
performance for Jsonnet code calling those library functions.

Standard library

- std.all
- std.any
- std.split and std.splitLimit support multi-character split strings
- std.splitLimitR

0.18.0

WASM
-----------
- The Jsonnet website now uses a WASM build of go-jsonnet for its online demos instead of an emscripten build of the C++ implementation. This is part of the ongoing migration towards go-jsonnet and away from C++ Jsonnet.

Language
--------------
- Unicode characters outside the "basic multilingual plane" (i.e. beyond the first 64k of them) now supported in unicode escapes in string literals that use unicode surrogate pairs.

Tooling
-----------
- Formatter now strips excess newlines after a comment at the end of a file.

Standard library
---------------------
- Performance improvement to `std.stripChars`
- New: `std.objectGetOrDefault` and `std.objectGetOrDefaultAll`
- New: `quote_keys` parameter for `std.manifestYamlDoc`
- New: `std.manifestToml`
- New: `std.manifestJsonMinified`
- New: `std.parseYaml`

Page 1 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.