Skip to content

Commit

Permalink
Address comments: Add Module Splitting support in the sbt-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
gzm0 committed Sep 27, 2020
1 parent 6ae1e52 commit cf66437
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions project/BinaryIncompatibilities.scala
Expand Up @@ -56,15 +56,15 @@ object BinaryIncompatibilities {
)

val SbtPlugin = Seq(
// Changes in LinkerImpl, which is declared that we can break it.
exclude[DirectMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl.outputFile"),
exclude[ReversedMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl.outputDirectory"),
exclude[DirectMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl#Reflect.outputFile"),
exclude[DirectMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl#Forwarding.outputFile"),
// Changes in LinkerImpl, which is declared that we can break it.
exclude[DirectMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl.outputFile"),
exclude[ReversedMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl.outputDirectory"),
exclude[DirectMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl#Reflect.outputFile"),
exclude[DirectMissingMethodProblem](
"org.scalajs.sbtplugin.LinkerImpl#Forwarding.outputFile"),
)

val TestCommon = Seq(
Expand Down
18 changes: 9 additions & 9 deletions project/Build.scala
Expand Up @@ -1769,9 +1769,9 @@ object Build {
}

val setDict = {
val dict = report.publicModules.map(m =>
s"${m.moduleID}: ${m.moduleID}"
).mkString("{", ",", "}")
val dict = report.publicModules
.map(m => s"${m.moduleID}: ${m.moduleID}")
.mkString("{", ",", "}")

s"main.setExportsNamespaceForExportsTest($dict);"
}
Expand All @@ -1785,17 +1785,17 @@ object Build {
* unlikely, though, given all the message passing for the com
* and all that.
*/
val imports = report.publicModules.map(m =>
s"""import * as ${m.moduleID} from "./${escapeJS(m.jsFileName)}";\n"""
).mkString
val imports = report.publicModules
.map(m => s"""import * as ${m.moduleID} from "./${escapeJS(m.jsFileName)}";\n""")
.mkString

IO.write(outputFile, imports + setDict)
List(Input.ESModule(outputFile.toPath))

case ModuleKind.CommonJSModule =>
val requires = report.publicModules.map(m =>
s"""var ${m.moduleID} = require("./${escapeJS(m.jsFileName)}");\n"""
).mkString
val requires = report.publicModules
.map(m => s"""var ${m.moduleID} = require("./${escapeJS(m.jsFileName)}");\n""")
.mkString

IO.write(outputFile, requires + setDict)
List(Input.CommonJSModule(outputFile.toPath))
Expand Down

0 comments on commit cf66437

Please sign in to comment.