fixes for kdocs

This commit is contained in:
InsanusMokrassar 2021-10-18 22:57:25 +06:00
parent c9237b3f00
commit cda9d09689
5 changed files with 53 additions and 23 deletions

View File

@ -6,6 +6,9 @@ import org.w3c.files.File
import org.w3c.files.FileReader import org.w3c.files.FileReader
import kotlin.js.Promise import kotlin.js.Promise
/**
* @suppress
*/
actual typealias MPPFile = File actual typealias MPPFile = File
fun MPPFile.readBytesPromise() = Promise<ByteArray> { success, failure -> fun MPPFile.readBytesPromise() = Promise<ByteArray> { success, failure ->
@ -23,10 +26,19 @@ fun MPPFile.readBytesPromise() = Promise<ByteArray> { success, failure ->
private suspend fun MPPFile.dirtyReadBytes(): ByteArray = readBytesPromise().await() private suspend fun MPPFile.dirtyReadBytes(): ByteArray = readBytesPromise().await()
/**
* @suppress
*/
actual val MPPFile.filename: FileName actual val MPPFile.filename: FileName
get() = FileName(name) get() = FileName(name)
/**
* @suppress
*/
actual val MPPFile.filesize: Long actual val MPPFile.filesize: Long
get() = size.toLong() get() = size.toLong()
/**
* @suppress
*/
@Warning("That is not optimized version of bytes allocator. Use asyncBytesAllocator everywhere you can") @Warning("That is not optimized version of bytes allocator. Use asyncBytesAllocator everywhere you can")
actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator
get() = ::dirtyReadBytes get() = ::dirtyReadBytes

View File

@ -4,12 +4,24 @@ import dev.inmo.micro_utils.coroutines.doInIO
import dev.inmo.micro_utils.coroutines.doOutsideOfCoroutine import dev.inmo.micro_utils.coroutines.doOutsideOfCoroutine
import java.io.File import java.io.File
/**
* @suppress
*/
actual typealias MPPFile = File actual typealias MPPFile = File
/**
* @suppress
*/
actual val MPPFile.filename: FileName actual val MPPFile.filename: FileName
get() = FileName(name) get() = FileName(name)
/**
* @suppress
*/
actual val MPPFile.filesize: Long actual val MPPFile.filesize: Long
get() = length() get() = length()
/**
* @suppress
*/
actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator
get() = { get() = {
doInIO { doInIO {

View File

@ -1,3 +1,6 @@
package dev.inmo.micro_utils.crypto package dev.inmo.micro_utils.crypto
/**
* @suppress
*/
actual fun SourceBytes.md5(): MD5 = CryptoJS.MD5(decodeToString()) actual fun SourceBytes.md5(): MD5 = CryptoJS.MD5(decodeToString())

View File

@ -3,6 +3,9 @@ package dev.inmo.micro_utils.crypto
import java.math.BigInteger import java.math.BigInteger
import java.security.MessageDigest import java.security.MessageDigest
/**
* @suppress
*/
actual fun SourceBytes.md5(): MD5 = BigInteger( actual fun SourceBytes.md5(): MD5 = BigInteger(
1, 1,
MessageDigest.getInstance("MD5").digest(this) MessageDigest.getInstance("MD5").digest(this)

View File

@ -13,10 +13,10 @@ repositories {
kotlin { kotlin {
jvm() jvm()
js(IR) { // js(IR) {
browser() // browser()
nodejs() // nodejs()
} // }
android {} android {}
sourceSets { sourceSets {
@ -29,7 +29,7 @@ kotlin {
it != project it != project
&& it.hasProperty("kotlin") && it.hasProperty("kotlin")
&& it.kotlin.sourceSets.any { it.name.contains("commonMain") } && it.kotlin.sourceSets.any { it.name.contains("commonMain") }
&& it.kotlin.sourceSets.any { it.name.contains("jsMain") } // && it.kotlin.sourceSets.any { it.name.contains("jsMain") }
&& it.kotlin.sourceSets.any { it.name.contains("jvmMain") } && it.kotlin.sourceSets.any { it.name.contains("jvmMain") }
&& it.kotlin.sourceSets.any { it.name.contains("androidMain") } && it.kotlin.sourceSets.any { it.name.contains("androidMain") }
) { ) {
@ -38,22 +38,22 @@ kotlin {
} }
} }
} }
jsMain { // jsMain {
dependencies { // dependencies {
implementation kotlin('stdlib') // implementation kotlin('stdlib')
project.parent.subprojects.forEach { // project.parent.subprojects.forEach {
if ( // if (
it != project // it != project
&& it.hasProperty("kotlin") // && it.hasProperty("kotlin")
&& it.kotlin.sourceSets.any { it.name.contains("commonMain") } // && it.kotlin.sourceSets.any { it.name.contains("commonMain") }
&& it.kotlin.sourceSets.any { it.name.contains("jsMain") } // && it.kotlin.sourceSets.any { it.name.contains("jsMain") }
) { // ) {
api it // api it
} // }
} // }
} // }
} // }
jvmMain { jvmMain {
dependencies { dependencies {
implementation kotlin('stdlib') implementation kotlin('stdlib')
@ -116,9 +116,9 @@ tasks.dokkaHtml {
sourceRoots.setFrom(findSourcesWithName("commonMain")) sourceRoots.setFrom(findSourcesWithName("commonMain"))
} }
named("jsMain") { // named("jsMain") {
sourceRoots.setFrom(findSourcesWithName("jsMain", "commonMain")) // sourceRoots.setFrom(findSourcesWithName("jsMain", "commonMain"))
} // }
named("jvmMain") { named("jvmMain") {
sourceRoots.setFrom(findSourcesWithName("jvmMain", "commonMain")) sourceRoots.setFrom(findSourcesWithName("jvmMain", "commonMain"))