Skip to content

Commit

Permalink
Fixed metadata compilation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhinkin committed Apr 24, 2024
1 parent 3b07a49 commit b0a830c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
11 changes: 11 additions & 0 deletions core/js/src/node/initializers.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/

package kotlinx.io.node

internal actual fun bufferInitializer(): BufferModule? = js("eval('require')('buffer')")
internal actual fun osInitializer(): Os? = js("eval('require')('os')")
internal actual fun fsInitializer(): Fs? = js("eval('require')('fs')")
internal actual fun pathInitializer(): Path? = js("eval('require')('path')")
4 changes: 1 addition & 3 deletions core/nodeFilesystemShared/src/node/buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package kotlinx.io.node

import kotlinx.io.withCaughtException

internal external interface BufferModule {
val Buffer: BufferObj
}
Expand All @@ -28,4 +26,4 @@ internal val buffer: BufferModule by lazy {
loadModule("buffer", ::bufferInitializer)
}

private fun bufferInitializer(): BufferModule? = js("eval('require')('buffer')")
internal expect fun bufferInitializer(): BufferModule?
2 changes: 1 addition & 1 deletion core/nodeFilesystemShared/src/node/fs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ internal val fs: Fs by lazy {
loadModule("fs", ::fsInitializer)
}

private fun fsInitializer(): Fs? = js("eval('require')('fs')")
internal expect fun fsInitializer(): Fs?
2 changes: 1 addition & 1 deletion core/nodeFilesystemShared/src/node/os.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ internal val os: Os by lazy {
loadModule("os", ::osInitializer)
}

private fun osInitializer(): Os? = js("eval('require')('os')")
internal expect fun osInitializer(): Os?
2 changes: 1 addition & 1 deletion core/nodeFilesystemShared/src/node/path.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ internal val path: Path by lazy {
loadModule("path", ::pathInitializer)
}

private fun pathInitializer(): Path? = js("eval('require')('path')")
internal expect fun pathInitializer(): Path?
11 changes: 11 additions & 0 deletions core/wasmJs/src/node/initializers.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/

package kotlinx.io.node

internal actual fun bufferInitializer(): BufferModule? = js("eval('require')('buffer')")
internal actual fun osInitializer(): Os? = js("eval('require')('os')")
internal actual fun fsInitializer(): Fs? = js("eval('require')('fs')")
internal actual fun pathInitializer(): Path? = js("eval('require')('path')")

0 comments on commit b0a830c

Please sign in to comment.