Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

1<!-- 2 SPDX-License-Identifier: Apache-2.0 3 SPDX-FileCopyrightText: 2020 The Gleam contributors 4--> 5 6# Changelog 7 8## v1.16.0 - 2026-04-24 9 10## v1.16.0-rc4 - 2026-04-22 11 12### Build tool 13 14- Enabling JavaScript source map generation will now copy the source Gleam 15 files to the output directory. This means that source maps will work in 16 browsers without any further processing before being served. 17 ([Louis Pilfold](https://github.com/lpil)) 18 19### Bug fixes 20 21- The `sources` property of source map files now uses a relative URL to the 22 source file. Previously it was using a filesystem path, which would not work 23 in all JavaScript environments. 24 ([Louis Pilfold](https://github.com/lpil)) 25 26## v1.16.0-rc3 - 2026-04-20 27 28### Build tool 29 30- New Gleam packages are now generated requiring `>= 1.0.0` of `gleam_stdlib`. 31 ([Surya Rose](https://github.com/GearsDatapacks)) 32 33### Bug fixes 34 35- Fixed a bug where certain invalid programs would type check if they contained 36 many mutually recursive functions. 37 ([Surya Rose](https://github.com/GearsDatapacks)) 38 39## v1.16.0-rc2 - 2026-04-14 40 41### Build tool 42 43- Added `mts`, `cts`, `jsx`, `tsx` to native file extensions so you can use 44 external JavaScript code from files with these file extensions. 45 ([Niklas Kirschall](https://github.com/nkxxll)) 46 47### Bug fixes 48 49- `manifest.toml` files with invalid package names now raise an error 50 immediately when the file is parsed. 51 ([Louis Pilfold](https://github.com/lpil)) 52 53- Fixed a bug where the "Wrap in anonymous function" code action could be used 54 in the body of a `use` expression 55 ([Giovanni Maria Zanchetta](https://github.com/GioMaz)) 56 57## v1.16.0-rc1 - 2026-04-10 58 59### Compiler 60 61- The compiler now reports all errors and warnings it can find in modules that 62 do not depend on each other, while previously it would always stop at the 63 first module with an error. 64 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 65 66- The compiler now supports list prepending in constants. For example: 67 68 ```gleam 69 pub const viviparous_mammals = ["dog", "cat", "human"] 70 71 pub const all_mammals = ["platypus", "echidna", ..viviparous_mammals] 72 ``` 73 74 ([Surya Rose](https://github.com/GearsDatapacks)) 75 76- The analysis of record update expressions is now fault tolerant, meaning the 77 compiler will no longer stop reporting errors at the first invalid field it 78 finds. 79 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 80 81- The compiler now shows a better error message when trying to use the record 82 update syntax with variants that have no labelled fields. 83 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 84 85- The error message for invalid deprecated attributes with no deprecation 86 message has been improved. For example, the following code: 87 88 ```gleam 89 pub type HashAlgorithm { 90 @deprecated 91 Md5 92 Sha224 93 Sha512 94 } 95 ``` 96 97 Will raise the following error: 98 99 ```txt 100 error: Syntax error 101 ┌─ /src/parse/error.gleam:3:3 102103 3 │ @deprecated 104 │ ^^^^^^^^^^^ A deprecation attribute must have a string message. 105 106 See: https://tour.gleam.run/functions/deprecations/ 107 ``` 108 109 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 110 111- The compiler now raises a warning on the JavaScript target when defining an 112 int segment with a size higher than 52 bits. For example, this code: 113 114 ```gleam 115 pub fn go(sha: BitArray) { 116 let <<_, number:152>> = sha 117 number 118 } 119 ``` 120 121 Will result in the following warning: 122 123 ```txt 124 warning: Truncated bit array segment 125 ┌─ /src/app/warning.gleam:3:20 126127 3 │ let <<_, number:152>> = sha 128 │ ^^^ 129 130 This segment is a 152-bit long int, but on the JavaScript target 131 numbers have at most 52 bits. It would be truncated to its first 52 bits. 132 Hint: Did you mean to use the `bytes` segment option? 133 ``` 134 135 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 136 137- The compiler now emits a helpful error message when source code contains an 138 invalid unicode character that looks similar to a correct character. 139 140 ``` 141 error: Syntax error 142 ┌─ /src/parse/error.gleam:1:20 143144 1 │ pub fn main() { #(1‚ 2) } 145 │ ^ Unexpected character 146 147 This looks like ascii comma, but it is actually the unicode low single 148 comma quotation mark. 149 ``` 150 151 ([Louis Pilfold](https://github.com/lpil)) 152 153- The compiler now emits more efficient code when matching on single-character 154 string prefixes on the JavaScript target. For example, the `glance` package 155 is now nearly 30% faster on the JavaScript target: 156 157 ``` 158 # before: 159 min: 10.8ms, max: 365.82ms, median: 14.74ms, mean: 14.76ms 160 warmup: 100/1.5s, total post-warmup: 1000/14.76s 161 162 # after: 163 min: 8.96ms, max: 143.76ms, median: 10.72ms, mean: 11.06ms 164 warmup: 100/1.24s, total post-warmup: 1000/11.06s 165 ``` 166 167 ([Surya Rose](https://github.com/GearsDatapacks)) 168 169- The compiler can now emit source maps when targeting JavaScript. This can be 170 enabled in the `gleam.toml` with the `source_maps` setting under the 171 `javascript` section. 172 ([Ameen Radwan](https://github.com/Acepie)) 173 174### Build tool 175 176- The `gleam hex owner add` command has been added, which allows adding 177 owners to the package. 178 ([Niklas Kirschall](https://github.com/nkxxll)) 179 180- When publishing, the package manager now uses the full term instead of the 181 shorthand "MFA" in the prompt and error message. 182 ([Luka Ivanović](https://github.com/luka-hash)) 183 184- When Hex rejects publish with error 422, show error message instead of 185 defaulting to "can only modify a release up to one hour after publication" 186 ([David Matz](https://github.com/d-matz)) 187 188- The `gleam publish` command now has documentation for its options. 189 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 190 191- The `gleam hex retire` command now accepts three flags `--package`, 192 `--version`, and `--reason` instead of positional arguments. 193 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 194 195- The `gleam hex unretire` command now accepts two flags `--package`, and 196 `--version` instead of positional arguments. 197 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 198 199- The `gleam hex owner transfer` command now accepts a flag `--package` instead 200 of a positional argument. 201 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 202 203- The `gleam docs build` command no longer recompiles all the project's 204 dependencies every single time it is run. 205 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 206 207- The build tool now produces a nicer error message when trying to add a 208 package's version that doesn't exist. For example, running `gleam add wisp@11` 209 will now produce: 210 211 ```txt 212 error: Dependency resolution failed 213 214 The package `wisp` has no versions in the range >= 11.0.0 and < 12.0.0. 215 ``` 216 217 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 218 219- The build tool will now suggest to create a module in the `dev` or `test` 220 directory, if that missing module is a dev module or a test module 221 respectively. 222 ([Andrey Kozhev](https://github.com/ankddev)) 223 224- Now all options with declared variants have consistent representation of 225 possible values. 226 ([Andrey Kozhev](https://github.com/ankddev)) 227 228- New Gleam packages are generated requiring >= 0.70.0 of `gleam_stdlib`. 229 ([Louis Pilfold](https://github.com/lpil)) 230 231- `gleam.toml` files with invalid dependency names now raise an error 232 immediately when the file is parsed. 233 ([Louis Pilfold](https://github.com/lpil)) 234 235- Documentation for `--target` option has been improved to include more 236 details. 237 ([Andrey Kozhev](https://github.com/ankddev)) 238 239### Language server 240 241- The language server will now show a diagnostic if you have a file open that 242 could not be analysed due to its dependencies failing to compile. 243 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 244 245- The language server now offers code actions to wrap a function reference in an 246 anonymous function, or to remove a trivial anonymous function, leaving its 247 contents. For example: 248 249 ```gleam 250 pub fn main() { 251 [-1, -2, -3] |> list.map(fn(a) { int.absolute_value(a) }) 252 // ^^ Activating the "Remove anonymous function" 253 // code action here 254 } 255 ``` 256 257 Would result in: 258 259 ```gleam 260 pub fn main() { 261 [-1, -2, -3] |> list.map(int.absolute_value) 262 } 263 ``` 264 265 While the other action would reverse the change. 266 267 ([Eli Treuherz](http://github.com/treuherz)) 268 269- The "extract function" code action can now be used in pipelines to extract a 270 part of one into a function. For example, triggering it here: 271 272 ```gleam 273 pub fn words() { 274 string 275 |> string.lowercase 276 // ^^^ 277 |> string.replace(each: "jak", with: "lucy") 278 // ^^^ selecting these two steps of the pipeline 279 |> string.split(on: " ") 280 } 281 ``` 282 283 Would result in the following code: 284 285 ```gleam 286 pub fn words() { 287 string 288 |> function 289 |> string.split(on: " ") 290 } 291 292 fn function(string: String) -> String { 293 string 294 |> string.lowercase 295 |> string.replace(each: "jak", with: "lucy") 296 } 297 ``` 298 299 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 300 301- The "extract function" code action can now be used to extract the right hand 302 side of an assignment into its own function. For example, triggering it here: 303 304 ```gleam 305 pub fn personal_blog() { 306 let introduction = 307 html.main([], [ 308 html.h1([], [html.text("Hello, world!")]), 309 html.p([], [html.text("Gleam is cool")]) 310 ]) 311 //^^^ Triggering "extract function" on this expression 312 313 html.body([introduction, blog_posts()]) 314 } 315 ``` 316 317 Would result in the following code: 318 319 ```gleam 320 pub fn personal_blog() { 321 let introduction = function() 322 html.body([introduction, blog_posts()]) 323 } 324 325 pub fn function() { 326 html.main([], [ 327 html.h1([], [html.text("Hello, world!")]), 328 html.p([], [html.text("Gleam is cool")]) 329 ]) 330 } 331 ``` 332 333 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 334 335- The "extract variable" code action can now pick better names for variables in 336 case branches and blocks, ignoring unrelated names of variables in other 337 branches. 338 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 339 340- The language server now has a code action to replace a `_` in a type 341 annotation with the corresponding type. For example: 342 343 ```gleam 344 pub fn load_user(id: Int) -> Result(_, Error) { 345 // ^ 346 // Triggering the code action here 347 sql.find_by_id(id) 348 |> result.map_error(CannotLoadUser) 349 } 350 ``` 351 352 Triggering the code action over the `_` will result in the following code: 353 354 ```gleam 355 pub fn load_user(id: Int) -> Result(User, Error) { 356 sql.find_by_id(id) 357 |> result.map_error(CannotLoadUser) 358 } 359 ``` 360 361 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 362 363- The language server now shows completions for the labelled argument of a 364 record when writing a record update. 365 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 366 367- The language server no longer shows completions for values when editing a 368 qualified type. 369 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 370 371### Formatter 372 373- The formatter no longer moves comments out of type annotations. 374 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 375 376- The formatting of long nested tuples has been improved. 377 Previously the formatter would split only the last tuple: 378 379 ```gleam 380 #(#(wibble, wobble), #(some_long_tuple, passed_as_last_argument)) 381 // after format: 382 #(#(wibble, wobble), #( 383 some_long_tuple, 384 passed_as_last_argument 385 )) 386 ``` 387 388 But now it favours first splitting each element onto its own line: 389 390 ```gleam 391 #(#(wibble, wobble), #(some_long_tuple, passed_as_last_argument)) 392 // after format: 393 #( 394 #(wibble, wobble), 395 #(some_long_tuple, passed_as_last_argument) 396 ) 397 ``` 398 399 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 400 401### Bug fixes 402 403- Fixed a bug where some functions could be formatted to be longer than 80 404 characters. 405 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 406 407- Fixed a bug that would result in not being able to publish a package if some 408 non-ASCII characters were used in field names other than `description`. 409 ([Niklas Kirschall](https://github.com/nkxxll)) 410 411- Fixed a bug where arithmetic operators in bit array size expressions were 412 not left-associative, causing `a - b - c` to be evaluated as 413 `a - (b - c)` instead of `(a - b) - c`. 414 ([Daniele Scaratti](https://github.com/lupodevelop)) 415 416- Fixed a bug where the compiler would crash when trying to read the cache for 417 modules containing large constants. 418 ([Surya Rose](https://github.com/GearsDatapacks)) 419 420- Fixed a bug where `BitArray$BitArray$data` constructed a `DataView` with 421 incorrect byte length instead of the slice's actual size, causing sliced bit 422 arrays to include extra bytes from the underlying buffer on JavaScript. 423 ([John Downey](https://github.com/jtdowney)) 424 425- The compiler now parses UTF-8 source files with a byte-order mark correctly, 426 instead of raising an error. 427 ([Lucy McPhail](https://github.com/lucymcphail)) 428 429- Fixed a bug where semicolons would not be properly added to pipelines in 430 generated JavaScript code, leading to runtime errors in certain circumstances. 431 ([Surya Rose](https://github.com/GearsDatapacks)) 432 433- Fixed a bug where the compiler would not generate the correct code on the 434 Erlang target for bit array string segments with the `utf16` and `utf32` 435 option. 436 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 437 438- Fixed the formatting of some errors' hints to properly wrap. 439 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 440 441- Fixed a bug where box drawing characters would not use the same monospace font 442 as all other characters inside code blocks in the generated documentation. 443 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 444 445- Fixed a bug where the "Add missing type parameter" code action could be 446 triggered on types that do not exist instead of type variables. 447 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 448 449- Fixed a bug where the "Add missing patterns" code action could end up deleting 450 comments inside an incomplete case expression. 451 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 452 453- Fixed a bug where the "Extract function" could generate invalid code when 454 triggered on a use statement inside a block. 455 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 456 457- Fixed a bug where constants referenced in a bit-array pattern's size option 458 would report as unused. 459 ([Louis Pilfold](https://github.com/lpil)) 460 461- Fixed a bug where the JavaScript code generator could produce duplicate `let` 462 declarations for internal variables after a `case` expression whose subject 463 directly matches one of the branches. 464 ([Eyup Can Akman](https://github.com/eyupcanakman)) 465 466## v1.15.1 - 2026-03-17 467 468### Bug fixes 469 470- Fixed a bug where `BitArray$BitArray$data` constructed a `DataView` with 471 offset 0 instead of the slice's actual byte offset, causing sliced bit arrays 472 to read from the wrong position in the underlying buffer on JavaScript. 473 ([John Downey](https://github.com/jtdowney))