Skip to content

Commit

Permalink
Merge pull request #3 from ShiftLeftSecurity/max/updateDeps
Browse files Browse the repository at this point in the history
Updated dependencies
  • Loading branch information
max-leuthaeuser authored Aug 30, 2021
2 parents afe339f + a60921b commit ab6fdb9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
19 changes: 9 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val cpgVersion = "1.3.286"
val cpgVersion = "1.3.304"

val gitCommitString = SettingKey[String]("gitSha")

Expand Down Expand Up @@ -78,7 +78,7 @@ lazy val commonSettings = Seq(
),
resolvers ++= Seq(
Resolver.mavenLocal,
"Atlassian Maven Repository" at "https://maven.atlassian.com/repository/public",
"Atlassian Maven Repository" at "https://maven.atlassian.com/repository/public"
),
libraryDependencies ++= Seq(
"io.shiftleft" %% "codepropertygraph" % cpgVersion,
Expand All @@ -89,7 +89,7 @@ lazy val commonSettings = Seq(
"org.slf4j" % "slf4j-api" % "1.7.32",
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.14.1" % Runtime,
"com.typesafe.play" %% "play-json" % "2.9.2",
"com.atlassian.sourcemap" % "sourcemap" % "1.7.7",
"com.atlassian.sourcemap" % "sourcemap" % "2.0.0",
"commons-io" % "commons-io" % "2.11.0",
"org.scalatest" %% "scalatest" % "3.2.9" % Test
),
Expand All @@ -111,11 +111,10 @@ lazy val js2cpg = (project in file(".")).settings(
homepage := Some(url("https://github.com/ShiftLeftSecurity/js2cpg/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"max-leuthaeuser",
"Max Leuthäuser",
"[email protected]",
url("https://github.com/max-leuthaeuser"))
Developer("max-leuthaeuser",
"Max Leuthäuser",
"[email protected]",
url("https://github.com/max-leuthaeuser"))
),
publishMavenStyle := true,
gitCommitString := git.gitHeadCommit.value.getOrElse("n/a"),
Expand All @@ -129,5 +128,5 @@ lazy val cfgIntegrationTests = project.settings(
Test / test := ((Test / test) dependsOn (js2cpg / stage)).value
)

Universal/packageName := name.value
Universal/topLevelDirectory := None
Universal / packageName := name.value
Universal / topLevelDirectory := None
8 changes: 4 additions & 4 deletions src/main/scala/io/shiftleft/js2cpg/parser/JsSource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.shiftleft.js2cpg.parser

import java.nio.file.{Path, Paths}
import better.files.File
import com.atlassian.sourcemap.{SourceMap, SourceMapImpl}
import com.atlassian.sourcemap.{ReadableSourceMap, ReadableSourceMapImpl}
import com.oracle.js.parser.Source
import com.oracle.js.parser.ir.Node
import io.shiftleft.js2cpg.io.FileDefaults._
Expand Down Expand Up @@ -34,7 +34,7 @@ class JsSource(val srcDir: File, val projectDir: Path, val source: Source) {
private val MAX_CODE_LENGTH = 100

private case class SourceMapOrigin(sourceFilePath: Path,
sourceMap: Option[SourceMap],
sourceMap: Option[ReadableSourceMap],
sourceWithLineNumbers: Map[Int, String])

/**
Expand Down Expand Up @@ -109,8 +109,8 @@ class JsSource(val srcDir: File, val projectDir: Path, val source: Source) {
} else {
Using(FileUtils.bufferedSourceFromFile(Paths.get(mapFilePath))) { sourceMapBuffer =>
val sourceMap =
new SourceMapImpl(FileUtils.contentFromBufferedSource(sourceMapBuffer))
val sourceFileNames = sourceMap.getSourceFileNames.asScala
ReadableSourceMapImpl.fromSource(FileUtils.contentFromBufferedSource(sourceMapBuffer))
val sourceFileNames = sourceMap.getSources.asScala

// The source file might not exist, e.g., if it was the result of transpilation
// but is not delivered and still referenced in the source map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package io.shiftleft.js2cpg.preprocessing

import better.files.File
import com.atlassian.sourcemap.{SourceMap, SourceMapImpl}
import com.atlassian.sourcemap.WritableSourceMap
import com.atlassian.sourcemap.WritableSourceMapImpl.Builder
import io.shiftleft.js2cpg.core.Config
import io.shiftleft.js2cpg.io.FileDefaults.{EJS_SUFFIX, JS_SUFFIX}
import io.shiftleft.js2cpg.io.FileUtils
Expand Down Expand Up @@ -31,8 +32,8 @@ class EjsTranspiler(override val config: Config, override val projectPath: Path)
private def extractJsCode(tpl: String,
positionToLineNumberMapping: SortedMap[Int, Int],
positionToFirstPositionInLineMapping: SortedMap[Int, Int],
ejsFileName: String): (String, SourceMap) = {
val sourceMap = new SourceMapImpl()
ejsFileName: String): (String, WritableSourceMap) = {
val sourceMap = new Builder().withSources(java.util.List.of(ejsFileName)).build()
val result = mutable.ArrayBuffer.empty[String]
TAGS_REGEX.findAllIn(tpl).matchData.foreach { ma =>
val tag = ma.toString
Expand Down

0 comments on commit ab6fdb9

Please sign in to comment.