Generate relative paths in JS source maps

Also, add CLI options to manipulate prefixes of path

See KT-4078
This commit is contained in:
Alexey Andreev
2017-06-09 14:52:04 +03:00
parent 44d3b8fb1a
commit 13ab63ae09
39 changed files with 399 additions and 18 deletions
@@ -48,6 +48,18 @@ interface KotlinJsOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
*/
var sourceMap: kotlin.Boolean
/**
* Prefix for paths in a source map
* Default value: null
*/
var sourceMapPrefix: kotlin.String?
/**
* Base directories which are used to calculate relative paths to source files in source map
* Default value: null
*/
var sourceMapSourceRoots: kotlin.String?
/**
* Generate JS files for specific ECMA version
* Possible values: "v5"
@@ -59,6 +59,16 @@ internal abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.Ko
get() = sourceMapField ?: false
set(value) { sourceMapField = value }
private var sourceMapPrefixField: kotlin.String?? = null
override var sourceMapPrefix: kotlin.String?
get() = sourceMapPrefixField ?: null
set(value) { sourceMapPrefixField = value }
private var sourceMapSourceRootsField: kotlin.String?? = null
override var sourceMapSourceRoots: kotlin.String?
get() = sourceMapSourceRootsField ?: null
set(value) { sourceMapSourceRootsField = value }
private var targetField: kotlin.String? = null
override var target: kotlin.String
get() = targetField ?: "v5"
@@ -81,6 +91,8 @@ internal abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.Ko
noStdlibField?.let { args.noStdlib = it }
outputFileField?.let { args.outputFile = it }
sourceMapField?.let { args.sourceMap = it }
sourceMapPrefixField?.let { args.sourceMapPrefix = it }
sourceMapSourceRootsField?.let { args.sourceMapSourceRoots = it }
targetField?.let { args.target = it }
typedArraysField?.let { args.typedArrays = it }
}
@@ -98,6 +110,8 @@ internal fun org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments.fil
noStdlib = true
outputFile = null
sourceMap = false
sourceMapPrefix = null
sourceMapSourceRoots = null
target = "v5"
typedArrays = false
}