<commit_before>/*                     __                                               *\
**     ________ ___   / /  ___      __ ____  Scala.js tools             **
**    / __/ __// _ | / /  / _ | __ / // __/  (c) 2013-2014, LAMP/EPFL   **
**  __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \    http://scala-js.org/       **
** /____/\___/_/ |_/____/_/ | |__/ /____/                               **
**                          |/____/                                     **
\*                                                                      */


package scala.scalajs.tools.classpath

import scala.collection.immutable.{Seq, Traversable}

import scala.scalajs.tools.io._
import scala.scalajs.tools.logging._
import scala.scalajs.tools.packager.ScalaJSPackager

/** A CompleteCIClasspath that contains only IR as cijsCode */
class CompleteIRClasspath(
    /** The JS libraries the IR code depends on */
    jsLibs: Seq[VirtualJSFile],
    /** The IR itself. Ancestor count is used for later ordering */
    val scalaJSIR: Traversable[VirtualScalaJSIRFile],
    version: Option[String]
) extends CompleteCIClasspath(jsLibs, version) {

  /** Orders and desugars the contained IR.
   *
   *  Consider using ScalaJSPackager for a canonical way to do so. It allows to
   *  persist the resulting file and create a source map.
   */
  override def cijsCode: Seq[VirtualJSFile] = {
    import ScalaJSPackager._

    val output = WritableMemVirtualJSFile("temporary-package.js")
    (new ScalaJSPackager).packageIR(scalaJSIR, OutputConfig(output),
        NullLogger, addCoreJSLib = true)

    output :: Nil
  }
}<commit_msg>Fix #724: Slowness of source map resolution with CompleteIRClasspath.<commit_after>/*                     __                                               *\
**     ________ ___   / /  ___      __ ____  Scala.js tools             **
**    / __/ __// _ | / /  / _ | __ / // __/  (c) 2013-2014, LAMP/EPFL   **
**  __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \    http://scala-js.org/       **
** /____/\___/_/ |_/____/_/ | |__/ /____/                               **
**                          |/____/                                     **
\*                                                                      */


package scala.scalajs.tools.classpath

import scala.collection.immutable.{Seq, Traversable}

import scala.scalajs.tools.io._
import scala.scalajs.tools.logging._
import scala.scalajs.tools.packager.ScalaJSPackager

/** A CompleteCIClasspath that contains only IR as cijsCode */
class CompleteIRClasspath(
    /** The JS libraries the IR code depends on */
    jsLibs: Seq[VirtualJSFile],
    /** The IR itself. Ancestor count is used for later ordering */
    val scalaJSIR: Traversable[VirtualScalaJSIRFile],
    version: Option[String]
) extends CompleteCIClasspath(jsLibs, version) {

  /** Orders and desugars the contained IR.
   *
   *  Consider using ScalaJSPackager for a canonical way to do so. It allows to
   *  persist the resulting file and create a source map.
   */
  override lazy val cijsCode: Seq[VirtualJSFile] = {
    import ScalaJSPackager._

    val output = WritableMemVirtualJSFile("temporary-package.js")
    (new ScalaJSPackager).packageIR(scalaJSIR, OutputConfig(output),
        NullLogger, addCoreJSLib = true)

    output :: Nil
  }
}
{'fraction_non_alphanumeric': 0.11286887739580165, 'fraction_numerical': 0.005780346820809248, 'mean_word_length': 1.728630705394191, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6891925', 'n_tokens_mistral': 1025, 'n_tokens_neox': 982, 'n_words': 211}