@@ -25,7 +25,6 @@ import kotlin.time.Duration.Companion.days
25
25
26
26
import kotlinx.serialization.encodeToString
27
27
import kotlinx.serialization.json.Json
28
- import kotlinx.serialization.json.JsonElement
29
28
import kotlinx.serialization.json.JsonObject
30
29
import kotlinx.serialization.json.JsonPrimitive
31
30
import kotlinx.serialization.json.decodeToSequence
@@ -101,7 +100,7 @@ class Yarn(
101
100
}
102
101
103
102
/* *
104
- * Parse the given [output ] of a Yarn _info_ command to a [PackageJson]. The output is typically a JSON object with the
103
+ * Parse the given [stdout ] of a Yarn _info_ command to a [PackageJson]. The output is typically a JSON object with the
105
104
* metadata of the package that was queried. However, under certain circumstances, Yarn may return multiple JSON objects
106
105
* separated by newlines; for instance, if the operation is retried due to network problems. This function filters for
107
106
* the object with the data based on the _type_ field. Result is *null* if no matching object is found or the input is
@@ -110,9 +109,9 @@ class Yarn(
110
109
* Note: The mentioned network issue can be reproduced by setting the network timeout to be very short via the command
111
110
* line option '--network-timeout'.
112
111
*/
113
- internal fun parseYarnInfo (output : String ): PackageJson ? =
112
+ internal fun parseYarnInfo (stdout : String ): PackageJson ? =
114
113
runCatching {
115
- output .byteInputStream().use { inputStream ->
114
+ stdout .byteInputStream().use { inputStream ->
116
115
Json .decodeToSequence<JsonObject >(inputStream)
117
116
.firstOrNull { (it[" type" ] as ? JsonPrimitive )?.content == " inspect" }?.let {
118
117
it[" data" ]?.let (::parsePackageJson)
0 commit comments