Skip to content

Commit 31fff38

Browse files
committed
feat: update for 1.13
1 parent 401ceed commit 31fff38

5 files changed

Lines changed: 30 additions & 21 deletions

File tree

gleam.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal_modules = ["internal", "internal/*"]
1717
gleam_stdlib = "~> 0.34 or ~> 1.0"
1818
glance = ">= 6.0.0"
1919
simplifile = ">= 2.3.1 and < 3.0.0"
20-
fswalk = ">= 3.0.3 and < 4.0.0"
20+
fswalk = ">= 3.1.0 and < 4.0.0"
2121
shellout = "~> 1.5"
2222
dot_env = ">= 1.2.0 and < 2.0.0"
2323
justin = "~> 1.0"

manifest.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
packages = [
55
{ name = "dot_env", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "simplifile"], otp_app = "dot_env", source = "hex", outer_checksum = "F2B4815F1B5AF8F20A6EADBB393E715C4C35203EBD5BE8200F766EA83A0B18DE" },
66
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
7-
{ name = "fswalk", version = "3.0.3", build_tools = ["gleam"], requirements = ["gleam_community_path", "gleam_stdlib", "gleam_yielder", "simplifile"], otp_app = "fswalk", source = "hex", outer_checksum = "2F0859F297348EAEA080925931B27CD84C0D6D18809D38AE18BE10A3D6512657" },
7+
{ name = "fswalk", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_community_path", "gleam_stdlib", "gleam_yielder", "simplifile"], otp_app = "fswalk", source = "hex", outer_checksum = "579530173EE64EDDF53CE02D21171E4CC0CB4F1D34DAA829D32B6009CD8E6FD5" },
88
{ name = "glance", version = "6.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "glexer"], otp_app = "glance", source = "hex", outer_checksum = "49E0ED4793BB3F56C3E5ED00528D70CAE21D263F70A735604124B95C5F62E2DB" },
99
{ name = "gleam_community_path", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_community_path", source = "hex", outer_checksum = "916C2829E2ED81036BBA180CFD5E8633D05E25C304FDF6E3BC8A048459B89725" },
1010
{ name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" },
@@ -20,12 +20,12 @@ packages = [
2020

2121
[requirements]
2222
dot_env = { version = ">= 1.2.0 and < 2.0.0" }
23-
fswalk = { version = ">= 3.0.3 and < 4.0.0" }
23+
fswalk = { version = ">= 3.1.0 and < 4.0.0" }
2424
glance = { version = ">= 6.0.0" }
2525
gleam_json = { version = ">= 3.1.0 and < 4.0.0" }
2626
gleam_stdlib = { version = "~> 0.34 or ~> 1.0" }
27+
gleam_yielder = { version = ">= 1.1.0 and < 2.0.0" }
2728
gleeunit = { version = "~> 1.0" }
2829
justin = { version = "~> 1.0" }
2930
shellout = { version = "~> 1.5" }
3031
simplifile = { version = ">= 2.3.1 and < 3.0.0" }
31-
gleam_yielder = { version = ">= 1.1.0 and < 2.0.0" }

src/ast.gleam

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1+
import evil.{expect}
12
import gleam/list
23
import gleam/string
34
import request.{type Request}
45

5-
pub fn get_import_path_from_mod_name(module_str: String, req: Request) {
6-
let path_res =
7-
list.find_map(in: req.module.imports, with: fn(imp) {
8-
let full_module_str = imp.definition.module
9-
case
10-
full_module_str == module_str
11-
|| string.ends_with(full_module_str, "/" <> module_str)
12-
{
13-
True -> Ok(full_module_str)
14-
_ -> Error(Nil)
15-
}
16-
})
17-
let assert Ok(path) = path_res
18-
as { module_str <> ": module not found in import list" }
19-
path
6+
pub fn get_import_path_from_mod_name(module_str: String, req: Request) -> String {
7+
list.find_map(in: req.module.imports, with: fn(imp) {
8+
let full_module_str = imp.definition.module
9+
case
10+
full_module_str == module_str
11+
|| string.ends_with(full_module_str, "/" <> module_str)
12+
{
13+
True -> Ok(full_module_str)
14+
_ -> Error(Nil)
15+
}
16+
})
17+
|> expect(module_str <> ": module not found in import list")
2018
}

src/evil.gleam

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import gleam/io
2+
3+
pub fn expect(x, msg) {
4+
case x {
5+
Ok(v) -> v
6+
Error(_) -> {
7+
io.print_error(msg)
8+
panic
9+
}
10+
}
11+
}

src/gserde.gleam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import dot_env/env
22
import fswalk
33
import glance
44
import gleam/bool
5+
import gleam/io
56
import gleam/list
67
import gleam/result
78
import gleam/string
@@ -68,7 +69,7 @@ pub fn process_single(src_filename: String, is_debug) {
6869
let assert Ok(parsed) =
6970
glance.module(code)
7071
|> result.map_error(fn(err) {
71-
echo err
72+
io.print_error(string.inspect(err))
7273
panic
7374
})
7475

@@ -96,7 +97,6 @@ pub fn process_single(src_filename: String, is_debug) {
9697
)
9798
})
9899
})
99-
echo custom_types
100100
let filecontent =
101101
list.map(requests, gen)
102102
|> list.map(fn(it) { it.1 })

0 commit comments

Comments
 (0)