Skip to content

Commit 94742f1

Browse files
committed
Announcing Scala.js 1.16.0.
1 parent 02a896c commit 94742f1

File tree

6 files changed

+119
-1
lines changed

6 files changed

+119
-1
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ colors: #in hex code if not noted else
6464

6565
### VERSIONS ###
6666
versions:
67-
scalaJS: 1.15.0
67+
scalaJS: 1.16.0
6868
scalaJSBinary: 1
6969
scalaJS06x: 0.6.33
7070
scalaJS06xBinary: 0.6

_data/library/versions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@
3232
- 1.11.0
3333
- 1.12.0
3434
- 1.13.0
35+
- 1.16.0
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
layout: post
3+
title: Announcing Scala.js 1.16.0
4+
category: news
5+
tags: [releases]
6+
permalink: /news/2024/03/19/announcing-scalajs-1.16.0/
7+
---
8+
9+
10+
We are excited to announce the release of Scala.js 1.16.0!
11+
12+
The biggest highlight of this release is that we added a Scala.js-specific minifier.
13+
When combined with a general-purpose JavaScript minifier, our minifier should bring most of the code size benefits of the Google Closure Compiler when the latter cannot be enabled, notably when emitting ECMAScript modules.
14+
15+
Scala.js 1.16.0 also upgrades by default to the standard library of Scala 2.12.19 and 2.13.13.
16+
17+
Read on for more details.
18+
19+
<!--more-->
20+
21+
## Getting started
22+
23+
If you are new to Scala.js, head over to [the tutorial]({{ BASE_PATH }}/tutorial/).
24+
25+
If you need help with anything related to Scala.js, you may find our community [in `#scala-js` on Discord](https://discord.com/invite/scala) and [on Stack Overflow](https://stackoverflow.com/questions/tagged/scala.js).
26+
27+
Bug reports can be filed [on GitHub](https://github.com/scala-js/scala-js/issues).
28+
29+
## Release notes
30+
31+
If upgrading from Scala.js 0.6.x, make sure to read [the release notes of Scala.js 1.0.0]({{ BASE_PATH }}/news/2020/02/25/announcing-scalajs-1.0.0/) first, as they contain a host of important information, including breaking changes.
32+
33+
This is a **minor** release:
34+
35+
* It is backward binary compatible with all earlier versions in the 1.x series: libraries compiled with 1.0.x through 1.15.x can be used with 1.16.0 without change.
36+
* It is *not* forward binary compatible with 1.15.x: libraries compiled with 1.16.0 cannot be used with 1.15.x or earlier.
37+
* It is *not* entirely backward source compatible: it is not guaranteed that a codebase will compile *as is* when upgrading from 1.15.x (in particular in the presence of `-Xfatal-warnings`).
38+
39+
As a reminder, libraries compiled with 0.6.x cannot be used with Scala.js 1.x; they must be republished with 1.x first.
40+
41+
## Enhancements with compatibility concerns
42+
43+
### Changes to the IR and linker APIs
44+
45+
For tooling authors who directly manipulate the IR and linker APIs, there have been some breaking changes in that area.
46+
This is in line with our version policy for the linker APIs.
47+
48+
The most likely changes you may hit are:
49+
50+
* `FieldName` is now a composite of the defining `ClassName` and a `SimpleFieldName`.
51+
* `StoreModule` has no parameter anymore; it implicitly applies to storing the `this` value of the enclosing module class.
52+
53+
## Enhancements
54+
55+
### Scala.js-specific minifier
56+
57+
In the `fullLink` mode, the Scala.js linker now includes dedicated code size optimizations.
58+
They are mostly useful when the Google Closure Compiler is deactivated, which is the case by default when emitting ECMAScript modules.
59+
60+
The most important optimization is that it compresses all *property* names (fields and methods) of Scala classes.
61+
It computes how frequently each one is used across the codebase, and assigns shorter names to the most frequent ones.
62+
63+
Renaming local and global variables and functions in this way is a standard feature of general-purpose JavaScript minifiers.
64+
However, in general they cannot rename *properties* without breaking the semantics of JavaScript programs.
65+
This is why Scala.js has leveraged Closure since the very first relase.
66+
Closure's so-called "advanced optimizations" assume that the JavaScript program fits in a specific subset of semantics, which allows it to rename properties.
67+
68+
Unfortunately, the way Closure handles ES modules is incompatible with what we need.
69+
Closure is therefore disabled when emitting ES modules from Scala.js.
70+
This has resulted in large bundle sizes for users of ES modules.
71+
72+
Our minifier, which is aware of our types and of Scala.js semantics, fills that gap between Closure and general-purpose minifiers.
73+
When combined with a general-purpose minifier such as the one bundled with Vite, the new optimizations bring code size around 15% bigger than Closure.
74+
Contrast that with the previous status quo, which was several *times* bigger than the Closure output.
75+
76+
If, for some reason, the new optimizations cause issues in your case, you can disable them with
77+
78+
{% highlight scala %}
79+
scalaJSLinkerConfig ~= { _.withMinify(false) }
80+
{% endhighlight %}
81+
82+
Please let us know if you encounter any issue with this new mode.
83+
84+
### Other code size improvements
85+
86+
In addition to the minifier, Scala.js 1.16.0 generally produces smaller .js files.
87+
This is the result of various code size optimizations that we apply in all configurations.
88+
89+
In particular, the optimizer now eagerly "dealiases" `val` fields of top-level objects if they are simple and if the object's initializer can be proven to be pure.
90+
91+
### Reduced memory consumption of the linker
92+
93+
The linker is generally optimized for *incremental* runs, which naturally requires to maintain a lot of caches in memory.
94+
We have started work on reducing the memory consumption of the linker without compromising on speed.
95+
This release already ships with the first installment of these improvements, reducing the memory footprint of the linker by 10%.
96+
If interested, you can find out the details [in the relevant pull request #4917](https://github.com/scala-js/scala-js/pull/4917).
97+
98+
## Bug fixes
99+
100+
Among others, the following bugs have been fixed in 1.16.0:
101+
102+
* [#4929](https://github.com/scala-js/scala-js/issues/4929) Assertion failed: Trying to move a local VarDef after the super constructor call of a non-native JS class
103+
* [#4949](https://github.com/scala-js/scala-js/issues/4949) Wrong pretty-printing of JS tree that *starts* with an object lit
104+
105+
You can find the full list [on GitHub](https://github.com/scala-js/scala-js/issues?q=is%3Aissue+milestone%3Av1.16.0+is%3Aclosed).

assets/badges/scalajs-1.16.0.svg

Lines changed: 1 addition & 0 deletions
Loading

doc/all-api.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ title: All previous versions of the Scala.js API
55

66
## All previous versions of the API
77

8+
### Scala.js 1.16.0
9+
* [1.16.0 scalajs-library]({{ site.production_url }}/api/scalajs-library/1.16.0/scala/scalajs/js/index.html)
10+
* [1.16.0 scalajs-test-interface]({{ site.production_url }}/api/scalajs-test-interface/1.16.0/)
11+
* [1.16.0 scalajs-javalib-intf]({{ site.production_url }}/api/scalajs-javalib-intf/1.16.0/)
12+
* [1.16.0 scalajs-ir]({{ site.production_url }}/api/scalajs-ir/1.16.0/org/scalajs/ir/index.html)
13+
* [1.16.0 scalajs-linker-interface]({{ site.production_url }}/api/scalajs-linker-interface/1.16.0/org/scalajs/linker/interface/index.html) ([Scala.js version]({{ site.production_url }}/api/scalajs-linker-interface-js/1.16.0/org/scalajs/linker/interface/index.html))
14+
* [1.16.0 scalajs-linker]({{ site.production_url }}/api/scalajs-linker/1.16.0/org/scalajs/linker/index.html) ([Scala.js version]({{ site.production_url }}/api/scalajs-linker-js/1.16.0/org/scalajs/linker/index.html))
15+
* [1.16.0 scalajs-test-adapter]({{ site.production_url }}/api/scalajs-sbt-test-adapter/1.16.0/org/scalajs/testing/adapter/index.html)
16+
* [1.16.0 sbt-scalajs]({{ site.production_url }}/api/sbt-scalajs/1.16.0/#org.scalajs.sbtplugin.package)
17+
818
### Scala.js 1.15.0
919
* [1.15.0 scalajs-library]({{ site.production_url }}/api/scalajs-library/1.15.0/scala/scalajs/js/index.html)
1020
* [1.15.0 scalajs-test-interface]({{ site.production_url }}/api/scalajs-test-interface/1.15.0/)

doc/internals/version-history.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Version history
55

66
## Version history of Scala.js
77

8+
- [1.16.0](/news/2024/03/19/announcing-scalajs-1.16.0/)
89
- [1.15.0](/news/2023/12/29/announcing-scalajs-1.15.0/)
910
- [1.14.0](/news/2023/09/25/announcing-scalajs-1.14.0/)
1011
- [1.13.2](/news/2023/06/23/announcing-scalajs-1.13.2/)

0 commit comments

Comments
 (0)