[Sourcemap] Extract addLink from SourceMap3Builder as a addSourceMappingURL
The general goal is remove dependency on TextOutput and make it simpler to use for wasm backend.
This commit is contained in:
committed by
Space Team
parent
9f82c43b1b
commit
e34d3d09bc
@@ -6,7 +6,6 @@ package org.jetbrains.kotlin.js.sourceMap
|
||||
|
||||
import gnu.trove.TObjectIntHashMap
|
||||
import org.jetbrains.kotlin.js.parser.sourcemaps.*
|
||||
import org.jetbrains.kotlin.js.util.TextOutput
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.Reader
|
||||
@@ -192,12 +191,6 @@ class SourceMap3Builder(
|
||||
}
|
||||
}
|
||||
|
||||
override fun addLink() {
|
||||
textOutput.print("\n//# sourceMappingURL=")
|
||||
textOutput.print(generatedFile!!.name)
|
||||
textOutput.print(".map\n")
|
||||
}
|
||||
|
||||
private object Base64VLQ {
|
||||
// A Base64 VLQ digit can represent 5 bits, so it is base-32.
|
||||
private const val VLQ_BASE_SHIFT = 5
|
||||
|
||||
@@ -10,8 +10,6 @@ import java.io.File;
|
||||
public interface SourceMapBuilder extends SourceMapMappingConsumer {
|
||||
void skipLinesAtBeginning(int count);
|
||||
|
||||
void addLink();
|
||||
|
||||
File getOutFile();
|
||||
|
||||
String build();
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.sourceMap
|
||||
|
||||
import org.jetbrains.kotlin.js.util.TextOutput
|
||||
import java.io.File
|
||||
|
||||
fun TextOutput.addSourceMappingURL(outputJsFile: File) {
|
||||
print("\n//# sourceMappingURL=")
|
||||
print(outputJsFile.name)
|
||||
print(".map\n")
|
||||
}
|
||||
Reference in New Issue
Block a user