Skip to content

Commit 8815166

Browse files
authored
Merge pull request #10 from inoas/improve-gleam-toml-add-version
2 parents 12c124e + b1d4466 commit 8815166

File tree

7 files changed

+44
-29
lines changed

7 files changed

+44
-29
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
## v1.0.6 - 2025-07-05
11+
12+
### Fixed
13+
14+
- Upgraded dependencies to fix recent `gleam_stdlib` compatibility.
15+
1016
## v1.0.5 - 2025-04-03
1117

1218
### Fixed

gleam.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "pprint"
2-
version = "1.0.5"
2+
version = "1.0.6"
33
description = "Pretty print values with style!"
44
licences = ["Apache-2.0"]
55
repository = { type = "github", user = "MystPi", repo = "pprint" }
@@ -8,8 +8,8 @@ internal_modules = ["pprint/decoder"]
88

99
[dependencies]
1010
gleam_stdlib = ">= 0.50.0 and < 2.0.0"
11-
glam = "~> 2.0"
11+
glam = ">= 2.0.0 and < 3.0.0"
1212

1313
[dev-dependencies]
14-
gleeunit = "~> 1.0"
15-
birdie = "~> 1.0"
14+
birdie = ">= 1.3.1 and < 2.0.0"
15+
gleeunit = ">= 1.0.0 and < 2.0.0"

manifest.toml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@
33

44
packages = [
55
{ name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" },
6-
{ name = "birdie", version = "1.2.6", build_tools = ["gleam"], requirements = ["argv", "edit_distance", "filepath", "glance", "gleam_community_ansi", "gleam_erlang", "gleam_stdlib", "justin", "rank", "simplifile", "term_size", "trie_again"], otp_app = "birdie", source = "hex", outer_checksum = "1363F4C7E7433A4A8350CC682BCDDBA5BBC6F66C94EFC63BC43025F796C4F6D0" },
6+
{ name = "birdie", version = "1.3.1", build_tools = ["gleam"], requirements = ["argv", "edit_distance", "filepath", "glance", "gleam_community_ansi", "gleam_stdlib", "justin", "rank", "simplifile", "term_size", "trie_again"], otp_app = "birdie", source = "hex", outer_checksum = "F811C9EDAF920EF48597A26E788907AAF80D9239A5E8C8CCFBD0DD1BB10184D7" },
77
{ name = "edit_distance", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "edit_distance", source = "hex", outer_checksum = "A1E485C69A70210223E46E63985FA1008B8B2DDA9848B7897469171B29020C05" },
8-
{ name = "filepath", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "65F51013BCF78A603AFFD7992EF1CC6ECA96C74038EB48887F656DE44DBC1902" },
8+
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
99
{ name = "glam", version = "2.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glam", source = "hex", outer_checksum = "4932A2D139AB0389E149396407F89654928D7B815E212BB02F13C66F53B1BBA1" },
10-
{ name = "glance", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "glexer"], otp_app = "glance", source = "hex", outer_checksum = "106111453AE9BA959184302B7DADF2E8CF322B27A7CB68EE78F3EE43FEACCE2C" },
10+
{ name = "glance", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "glexer"], otp_app = "glance", source = "hex", outer_checksum = "FAA3DAC74AF71D47C67D88EB32CE629075169F878D148BB1FF225439BE30070A" },
1111
{ name = "gleam_community_ansi", version = "1.4.3", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "8A62AE9CC6EA65BEA630D95016D6C07E4F9973565FA3D0DE68DC4200D8E0DD27" },
12-
{ name = "gleam_community_colour", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "FDD6AC62C6EC8506C005949A4FCEF032038191D5EAAEC3C9A203CD53AE956ACA" },
13-
{ name = "gleam_erlang", version = "0.34.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "0C38F2A128BAA0CEF17C3000BD2097EB80634E239CE31A86400C4416A5D0FDCC" },
14-
{ name = "gleam_json", version = "2.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "C55C5C2B318533A8072D221C5E06E5A75711C129E420DD1CE463342106012E5D" },
15-
{ name = "gleam_regexp", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "7F5E0C0BBEB3C58E57C9CB05FA9002F970C85AD4A63BA1E55CBCB35C15809179" },
16-
{ name = "gleam_stdlib", version = "0.58.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "091F2D2C4A3A4E2047986C47E2C2C9D728A4E068ABB31FDA17B0D347E6248467" },
17-
{ name = "gleeunit", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "0E6C83834BA65EDCAAF4FE4FB94AC697D9262D83E6F58A750D63C9F6C8A9D9FF" },
12+
{ name = "gleam_community_colour", version = "2.0.2", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "E34DD2C896AC3792151EDA939DA435FF3B69922F33415ED3C4406C932FBE9634" },
13+
{ name = "gleam_json", version = "3.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "874FA3C3BB6E22DD2BB111966BD40B3759E9094E05257899A7C08F5DE77EC049" },
14+
{ name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" },
15+
{ name = "gleam_stdlib", version = "0.61.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "3DC407D6EDA98FCE089150C11F3AD892B6F4C3CA77C87A97BAE8D5AB5E41F331" },
16+
{ name = "gleeunit", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "63022D81C12C17B7F1A60E029964E830A4CBD846BBC6740004FC1F1031AE0326" },
1817
{ name = "glexer", version = "2.2.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glexer", source = "hex", outer_checksum = "5C235CBDF4DA5203AD5EAB1D6D8B456ED8162C5424FE2309CFFB7EF438B7C269" },
1918
{ name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" },
2019
{ name = "rank", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "rank", source = "hex", outer_checksum = "5660E361F0E49CBB714CC57CC4C89C63415D8986F05B2DA0C719D5642FAD91C9" },
21-
{ name = "simplifile", version = "2.2.1", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "C88E0EE2D509F6D86EB55161D631657675AA7684DAB83822F7E59EB93D9A60E3" },
20+
{ name = "simplifile", version = "2.3.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0A868DAC6063D9E983477981839810DC2E553285AB4588B87E3E9C96A7FB4CB4" },
2221
{ name = "term_size", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "term_size", source = "hex", outer_checksum = "D00BD2BC8FB3EBB7E6AE076F3F1FF2AC9D5ED1805F004D0896C784D06C6645F1" },
23-
{ name = "trie_again", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "trie_again", source = "hex", outer_checksum = "5B19176F52B1BD98831B57FDC97BD1F88C8A403D6D8C63471407E78598E27184" },
22+
{ name = "trie_again", version = "1.1.3", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "trie_again", source = "hex", outer_checksum = "365FE609649F3A098D1D7FC7EA5222EE422F0B3745587BF2AB03352357CA70BB" },
2423
]
2524

2625
[requirements]
27-
birdie = { version = "~> 1.0" }
28-
glam = { version = "~> 2.0" }
26+
birdie = { version = ">= 1.3.1 and < 2.0.0" }
27+
glam = { version = ">= 2.0.0 and < 3.0.0" }
2928
gleam_stdlib = { version = ">= 0.50.0 and < 2.0.0" }
30-
gleeunit = { version = "~> 1.0" }
29+
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }

src/pprint.gleam

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ pub fn styled(value: a) -> String {
119119
with_config(value, Config(Styled, BitArraysAsString, NoLabels))
120120
}
121121

122+
@external(erlang, "pprint_ffi", "from")
123+
@external(javascript, "./pprint_ffi.mjs", "from")
124+
pub fn from(value: a) -> Dynamic
125+
122126
/// Pretty print a value as a string with a custom config.
123127
///
124128
/// # Examples
@@ -130,7 +134,7 @@ pub fn styled(value: a) -> String {
130134
///
131135
pub fn with_config(value: a, config: Config) -> String {
132136
value
133-
|> dynamic.from
137+
|> from
134138
|> pretty_dynamic(config)
135139
|> doc.to_string(max_width)
136140
}

src/pprint_ffi.erl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
-module(pprint_ffi).
2-
-export([decode_nil/1, decode_tuple/1, decode_custom_type/1]).
2+
-export([decode_nil/1, decode_tuple/1, decode_custom_type/1, from/1]).
33

44
-define(is_digit_char(X), (X > 47 andalso X < 58)).
55
-define(is_lowercase_char(X), (X > 96 andalso X < 123)).
66
-define(is_underscore_char(X), (X == 95)).
77

8+
from(X) ->
9+
X.
10+
811
decode_nil(X) ->
912
case X of
1013
nil -> {ok, nil};
@@ -58,11 +61,10 @@ inspect_maybe_gleam_atom(<<"_", _Rest/binary>>, none, _) ->
5861
{error, nil};
5962
inspect_maybe_gleam_atom(<<"_">>, _PrevChar, _Acc) ->
6063
{error, nil};
61-
inspect_maybe_gleam_atom(<<"_", _Rest/binary>>, $_, _Acc) ->
64+
inspect_maybe_gleam_atom(<<"_", _Rest/binary>>, $_, _Acc) ->
6265
{error, nil};
63-
inspect_maybe_gleam_atom(<<First, _Rest/binary>>, _PrevChar, _Acc) when
64-
not (?is_lowercase_char(First) orelse ?is_underscore_char(First) orelse ?is_digit_char(First))
65-
->
66+
inspect_maybe_gleam_atom(<<First, _Rest/binary>>, _PrevChar, _Acc)
67+
when not (?is_lowercase_char(First) orelse ?is_underscore_char(First) orelse ?is_digit_char(First)) ->
6668
{error, nil};
6769
inspect_maybe_gleam_atom(<<First, Rest/binary>>, none, Acc) ->
6870
inspect_maybe_gleam_atom(Rest, First, <<Acc/binary, (uppercase(First))>>);
@@ -74,7 +76,8 @@ inspect_maybe_gleam_atom(<<First, Rest/binary>>, _PrevChar, Acc) ->
7476
inspect_maybe_gleam_atom(Rest, First, <<Acc/binary, First>>);
7577
inspect_maybe_gleam_atom(<<>>, _PrevChar, Acc) ->
7678
{ok, Acc};
77-
inspect_maybe_gleam_atom(_, _, _) ->
79+
% The following function body is different from the stdlib:
80+
inspect_maybe_gleam_atom(_First, _Rest, _Acc) ->
7881
{error, nil}.
7982

8083
uppercase(X) -> X - 32.

src/pprint_ffi.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as $gleam from './gleam.mjs';
2-
import * as $decoder from './pprint/decoder.mjs';
1+
import * as $gleam from "./gleam.mjs";
2+
import * as $decoder from "./pprint/decoder.mjs";
33

44
export function decode_custom_type(value) {
55
if (value instanceof $gleam.CustomType) {
@@ -25,3 +25,7 @@ export function decode_nil(value) {
2525
if (value === undefined) return new $gleam.Ok(undefined);
2626
return new $gleam.Error(undefined);
2727
}
28+
29+
export function from(value) {
30+
return value;
31+
}

test/pprint_test.gleam

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import birdie
22
import gleam/dict
3-
import gleam/dynamic
43
import gleam/option.{None}
54
import gleam/set
65
import gleeunit
@@ -20,7 +19,7 @@ pub fn main() {
2019
// https://github.com/MystPi/pprint/issues/2
2120
pub fn custom_type_with_no_fields_decoding_test() {
2221
Wibble
23-
|> dynamic.from
22+
|> pprint.from
2423
|> decoder.classify
2524
|> should.equal(decoder.TCustom("Wibble", []))
2625
}

0 commit comments

Comments
 (0)