Update for Gleam 0.30

This commit is contained in:
Mikko Ahlroth 2023-07-22 11:09:00 +03:00
parent 7c1f67a46f
commit 2046e4105d
6 changed files with 24 additions and 17 deletions

View file

@ -1,3 +1,3 @@
gleam 0.29.0
gleam 0.30.2
erlang 25.2.2
nodejs 18.14.0

View file

@ -1,3 +1,8 @@
5.0.0
-----
* Update for Gleam 0.30.
4.0.1
-----

View file

@ -1,5 +1,5 @@
name = "glentities"
version = "4.0.1"
version = "5.0.0"
description = "HTML entity encoder/decoder for Gleam"
# Fill out these fields if you intend to generate HTML documentation or publish
@ -12,7 +12,7 @@ links = []
internal_modules = ["glentities/internal/*"]
[dependencies]
gleam_stdlib = "~> 0.29.0"
gleam_stdlib = "~> 0.29"
[dev-dependencies]
gleeunit = "~> 0.10"

View file

@ -2,10 +2,10 @@
# You typically do not need to edit this file
packages = [
{ name = "gleam_stdlib", version = "0.29.1", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "24581B17879AA903B3E7531869D9460730C2F772A1C02C774ABF75710CCC4CFE" },
{ name = "gleam_stdlib", version = "0.30.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "03710B3DA047A3683117591707FCA19D32B980229DD8CE8B0603EB5B5144F6C3" },
{ name = "gleeunit", version = "0.10.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "ECEA2DE4BE6528D36AFE74F42A21CDF99966EC36D7F25DEB34D47DD0F7977BAF" },
]
[requirements]
gleam_stdlib = "~> 0.29.0"
gleeunit = "~> 0.10"
gleam_stdlib = { version = "~> 0.29" }
gleeunit = { version = "~> 0.10" }

3
src/ffi_js.mjs Normal file
View file

@ -0,0 +1,3 @@
export function normalize(str, mode) {
return str.normalize(mode);
}

View file

@ -1,13 +1,12 @@
if erlang {
pub external fn normalise(text: String) -> String =
"unicode" "characters_to_nfc_binary"
@target(erlang)
@external(erlang, "unicode", "characters_to_nfc_binary")
pub fn normalise(text text: String) -> String
@target(javascript)
pub fn normalise(text: String) -> String {
normalise_js(text, "NFC")
}
if javascript {
pub fn normalise(text: String) -> String {
normalise_js(text, "NFC")
}
pub external fn normalise_js(text: String, mode: String) -> String =
"" "String.prototype.normalize.call"
}
@target(javascript)
@external(javascript, "../../ffi_js.mjs", "normalize")
pub fn normalise_js(text text: String, mode mode: String) -> String