Skip to content

Commit 1bddb56

Browse files
authored
Merge pull request #511 from sjrd/scalajs-1.2.0
Announcing Scala.js 1.2.0.
2 parents e0aaa89 + 9d966cb commit 1bddb56

File tree

6 files changed

+125
-1
lines changed

6 files changed

+125
-1
lines changed

_config.yml

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

5858
### VERSIONS ###
5959
versions:
60-
scalaJS: 1.1.1
60+
scalaJS: 1.2.0
6161
scalaJSBinary: 1
6262
scalaJS06x: 0.6.33
6363
scalaJS06xBinary: 0.6

_data/library/versions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
- 1.0.0-RC2
2323
- 1.0.0
2424
- 1.1.0
25+
- 1.2.0
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
layout: post
3+
title: Announcing Scala.js 1.2.0
4+
category: news
5+
tags: [releases]
6+
permalink: /news/2020/09/09/announcing-scalajs-1.2.0/
7+
---
8+
9+
10+
We are pleased to announce the release of Scala.js 1.2.0!
11+
12+
The highlight of this release is the addition of the JavaScript types `js.Map[K, V]` and `js.Set[T]` in the standard library.
13+
Thanks to [@exoego](https://github.com/exoego) for this contribution!
14+
15+
In addition, this release contains a number of bug fixes and small improvements.
16+
The version of the Scala standard library has been upgraded to Scala 2.12.12 and 2.13.3.
17+
18+
Read on for more details.
19+
20+
<!--more-->
21+
22+
## Getting started
23+
24+
If you are new to Scala.js, head over to [the tutorial]({{ BASE_PATH }}/tutorial/).
25+
26+
If you need help with anything related to Scala.js, you may find our community [on Gitter](https://gitter.im/scala-js/scala-js) and [on Stack Overflow](https://stackoverflow.com/questions/tagged/scala.js).
27+
28+
Bug reports can be filed [on GitHub](https://github.com/scala-js/scala-js/issues).
29+
30+
## Release notes
31+
32+
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.
33+
34+
This is a **minor** release:
35+
36+
* It is backward binary compatible with all earlier versions in the 1.x series: libraries compiled with 1.0.x and 1.1.x can be used with 1.2.0 without change.
37+
* It is *not* forward binary compatible with 1.1.x: libraries compiled with 1.2.0 cannot be used with 1.1.x or earlier.
38+
* It is *not* entirely backward source compatible: it is not guaranteed that a codebase will compile *as is* when upgrading from 1.1.x (in particular in the presence of `-Xfatal-warnings`).
39+
40+
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.
41+
42+
## Known source breaking changes
43+
44+
### `js.JSON.stringify`
45+
46+
The type of the `space` argument has been narrowed from `js.Any` in Scala.js <= 1.1.1 to `Int | String` in Scala.js 1.2.0.
47+
This may cause code that uses this method not to compile anymore.
48+
For example:
49+
50+
{% highlight scala %}
51+
def configString(config: js.Dictionary[String], mySpace: js.Any): String =
52+
js.JSON.stringify(config, space = mySpace)
53+
{% endhighlight %}
54+
55+
will stop compiling because `js.Any` is not a subtype of `Int | String`.
56+
Ideally, this issue would be addressed by changing the type of `mySpace` itself and the callers of `configString`.
57+
If that is not possible, for example due to binary compatibility constraints, it is always possible to use a cast:
58+
59+
{% highlight scala %}
60+
def configString(config: js.Dictionary[String], mySpace: js.Any): String =
61+
js.JSON.stringify(config, space = mySpace.asInstanceOf[Int | String])
62+
{% endhighlight %}
63+
64+
## Enhancements
65+
66+
### `js.Map[K, V]` and `js.Set[T]`
67+
68+
The standard library now contains definitions for the JavaScript built-in classes `Map` and `Set`, as `js.Map[K, V]` and `js.Set[T]`, respectively.
69+
Like `js.Array`, they support the full Scala collection API.
70+
71+
### ECMAScript module support in `testHtml`
72+
73+
The task `testHtml` creates a .html page that runs the unit tests of a codebase in a browser.
74+
Until Scala.js 1.1.1, it only supported Scripts (i.e., with the default `ModuleKind.NoModule`).
75+
Starting with v1.2.0, it also supports ECMAScript modules (`ModuleKind.ESModule`).
76+
77+
It still does not support CommonJS modules, since those are not supported by browsers at all.
78+
79+
### Export abstract JS classes
80+
81+
It is now possible to export `abstract` JS classes (that extend `js.Any`), for example:
82+
83+
{% highlight scala %}
84+
@JSExportTopLevel("AbstractBase")
85+
abstract class AbstractBase extends js.Object
86+
{% endhighlight %}
87+
88+
These can be extended by classes written in JavaScript.
89+
90+
## Miscellaneous
91+
92+
### New JDK APIs
93+
94+
* `java.util.Date.toInstant()` and `java.util.Date.from(Instant)`, although they will only transitively link if support for `java.time` APIs is enabled (e.g., using [scala-java-time](https://github.com/cquiroz/scala-java-time))
95+
* `java.lang.Character.codePointCount`
96+
97+
### Upgrade to GCC v20200719
98+
99+
The Google Closure Compiler used internally by Scala.js for `fullOptJS` has been upgraded to v20200719.
100+
101+
## Bug fixes
102+
103+
Among others, the following bugs have been fixed in 1.2.0:
104+
105+
* [#4131](https://github.com/scala-js/scala-js/issues/4131) `getTime` on `java.util.Date` returns `0` when initialized with a value outside the ECMAScript Time Range
106+
* [#4114](https://github.com/scala-js/scala-js/issues/4114) Compiler crash for JS class containing nested JS objects
107+
* [#4171](https://github.com/scala-js/scala-js/issues/4171) "`NoSuchElementException`: key not found: `LabelName<matchAlts1>`" with dotty 0.27.0-RC1
108+
* [#4174](https://github.com/scala-js/scala-js/issues/4174) fullOptJS shouldn't add a sourceMap references when sourceMap's are disabled
109+
* [#4151](https://github.com/scala-js/scala-js/issues/4151) Very Long String in source results in cryptic error message
110+
* [#4148](https://github.com/scala-js/scala-js/issues/4148) and [#4168](https://github.com/scala-js/scala-js/issues/4168) Unable to find extant inner trait IR during fastopt
111+
112+
You can find the full list [on GitHub](https://github.com/scala-js/scala-js/issues?q=is%3Aissue+milestone%3Av1.2.0+is%3Aclosed).

assets/badges/scalajs-1.2.0.svg

Lines changed: 1 addition & 0 deletions
Loading

doc/all-api.md

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

66
## All previous versions of the API
77

8+
### Scala.js 1.2.0
9+
* [1.2.0 scalajs-library]({{ site.production_url }}/api/scalajs-library/1.2.0/scala/scalajs/js/index.html)
10+
* [1.2.0 scalajs-test-interface]({{ site.production_url }}/api/scalajs-test-interface/1.2.0/)
11+
* [1.2.0 scalajs-ir]({{ site.production_url }}/api/scalajs-ir/1.2.0/org/scalajs/ir/index.html)
12+
* [1.2.0 scalajs-linker-interface]({{ site.production_url }}/api/scalajs-linker-interface/1.2.0/org/scalajs/linker/interface/index.html) ([Scala.js version]({{ site.production_url }}/api/scalajs-linker-interface-js/1.2.0/org/scalajs/linker/interface/index.html))
13+
* [1.2.0 scalajs-linker]({{ site.production_url }}/api/scalajs-linker/1.2.0/org/scalajs/linker/index.html) ([Scala.js version]({{ site.production_url }}/api/scalajs-linker-js/1.2.0/org/scalajs/linker/index.html))
14+
* [1.2.0 scalajs-test-adapter]({{ site.production_url }}/api/scalajs-sbt-test-adapter/1.2.0/org/scalajs/testing/adapter/index.html)
15+
* [1.2.0 sbt-scalajs]({{ site.production_url }}/api/sbt-scalajs/1.2.0/#org.scalajs.sbtplugin.package)
16+
817
### Scala.js 1.1.1
918
* [1.1.1 scalajs-library]({{ site.production_url }}/api/scalajs-library/1.1.1/scala/scalajs/js/index.html)
1019
* [1.1.1 scalajs-test-interface]({{ site.production_url }}/api/scalajs-test-interface/1.1.1/)

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.2.0](/news/2020/09/09/announcing-scalajs-1.2.0/)
89
- [1.1.1](/news/2020/07/02/announcing-scalajs-1.1.1/)
910
- [1.1.0](/news/2020/05/18/announcing-scalajs-1.1.0/)
1011
- [0.6.33](/news/2020/05/13/announcing-scalajs-0.6.33/)

0 commit comments

Comments
 (0)