scalameta / mdoc

Typechecked markdown documentation for Scala

Home Page:https://scalameta.org/mdoc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle empty module report list in Scala.js modifier

keynmol opened this issue · comments

Prior to 2.3.1, Mdoc.js was using a deprecated SJS API which explicitly wrote out an empty file if the list of produced JS modules is empty: https://github.com/scala-js/scala-js/blob/main/linker-interface/shared/src/main/scala/org/scalajs/linker/interface/ReportToLinkerOutputAdapter.scala#L51-L53

This can happen if your document only has mdoc:js:shared and mdoc:js:compile-only, none of which introduce a runnable entrypoint.

Most recently it was seen in PurpleKingdomGames/tyrian#70

In terms of error reporting, this looks like a regression, as there's nothing explicitly bad about only have shared/compile-only snippets

Besides the single-file and no-file cases, does many-file output need to be considered as well? This is for example used by the ES module linking mode I believe. The legacy API was also unable to handle this.

val linkingReport = scalajsApi.get.link(sjsirFiles.toArray)
val content = linkingReport.values().iterator().next()