From 03cb7f3ea8da425900e9a844f93197135b230fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Doeraene?= Date: Thu, 16 May 2024 17:38:40 +0200 Subject: [PATCH] Remove SourceMapWriterAccess. Now that we are in `linker.backend`, we can directly access it. --- .../backend/WebAssemblyLinkerBackend.scala | 5 +++-- .../webassembly/SourceMapWriterAccess.scala | 22 ------------------- 2 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 wasm/src/main/scala/org/scalajs/linker/backend/webassembly/SourceMapWriterAccess.scala diff --git a/wasm/src/main/scala/org/scalajs/linker/backend/WebAssemblyLinkerBackend.scala b/wasm/src/main/scala/org/scalajs/linker/backend/WebAssemblyLinkerBackend.scala index 7ce3c4e0..97224d5a 100644 --- a/wasm/src/main/scala/org/scalajs/linker/backend/WebAssemblyLinkerBackend.scala +++ b/wasm/src/main/scala/org/scalajs/linker/backend/WebAssemblyLinkerBackend.scala @@ -12,6 +12,7 @@ import org.scalajs.linker.interface._ import org.scalajs.linker.interface.unstable._ import org.scalajs.linker.standard._ +import org.scalajs.linker.backend.javascript.{ByteArrayWriter, SourceMapWriter} import org.scalajs.linker.backend.webassembly._ import org.scalajs.linker.backend.wasmemitter.Emitter @@ -88,13 +89,13 @@ final class WebAssemblyLinkerBackend( val emitDebugInfo = !linkerConfig.minify if (linkerConfig.sourceMap) { - val sourceMapWriter = new SourceMapWriterAccess.ByteArrayWriterBox() + val sourceMapWriter = new ByteArrayWriter val wasmFileURI = s"./$wasmFileName" val sourceMapURI = s"./$sourceMapFileName" val smWriter = - sourceMapWriter.createSourceMapWriter(wasmFileURI, linkerConfig.relativizeSourceMapBase) + new SourceMapWriter(sourceMapWriter, wasmFileURI, linkerConfig.relativizeSourceMapBase) val binaryOutput = new BinaryWriter.WithSourceMap( wasmModule, emitDebugInfo, diff --git a/wasm/src/main/scala/org/scalajs/linker/backend/webassembly/SourceMapWriterAccess.scala b/wasm/src/main/scala/org/scalajs/linker/backend/webassembly/SourceMapWriterAccess.scala deleted file mode 100644 index 5734c86f..00000000 --- a/wasm/src/main/scala/org/scalajs/linker/backend/webassembly/SourceMapWriterAccess.scala +++ /dev/null @@ -1,22 +0,0 @@ -package org.scalajs.linker.backend.webassembly - -import java.net.URI -import java.nio.ByteBuffer - -import org.scalajs.linker.backend.javascript.{ByteArrayWriter, SourceMapWriter} - -object SourceMapWriterAccess { - - /** A box to hold a `ByteArrayWriter`, which is unfortunately package-private in Scala.js but - * required to create a `SourceMapWriter`. - */ - final class ByteArrayWriterBox() { - private val underlying = new ByteArrayWriter() - - def createSourceMapWriter(jsFileName: String, relativizeBaseURI: Option[URI]): SourceMapWriter = - new SourceMapWriter(underlying, jsFileName, relativizeBaseURI) - - def toByteBuffer(): ByteBuffer = - underlying.toByteBuffer() - } -}