JetBrains/kotlin-wrappers

Separate coroutines-enabled code

Closed this issue · 1 comments

I've noticed that many modules, including the most basic kotlin-js one, add a dependency on coroutines.

jsMainImplementation(libs.coroutines.core)

I think it's surprising to see kotlinx-coroutines in a JS wrappers project, so I'd like to propose splitting the code.
For example:

  • kotlin-js - pure wrappers
  • kotlin-js-coroutines - build on top of kotlin-js and adds coroutines support

The same concept could be applied to other modules.
This could favor better dependency management from a consumer perspective, and encourage kotlinx libraries to adopt kotlin-wrappers types. For example, see discussion in kotlinx-io PR.


Related discussion

  1. Our current strategy is to enforce suspend calls over Promise calls.
  2. Solution for kotlinx-io and similar libraries - exclude coroutines from transitive dependencies.
  3. Additional changes from Kotlin Wrappers isn't expected.