@@ -19,6 +19,7 @@ package net.kautler
19
19
import net.kautler.dao.action.GitHubAction
20
20
import net.kautler.util.npm
21
21
import org.gradle.accessors.dm.LibrariesForLibs
22
+ import org.gradle.accessors.dm.LibrariesForKotlinWrappers
22
23
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec
23
24
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
24
25
import org.jetbrains.kotlin.gradle.tasks.IncrementalSyncTask
@@ -29,10 +30,11 @@ plugins {
29
30
}
30
31
31
32
val libs = the<LibrariesForLibs >()
33
+ val kotlinWrappers = the<LibrariesForKotlinWrappers >()
32
34
33
35
kotlin {
34
36
js {
35
- useCommonJs ()
37
+ useEsModules ()
36
38
binaries.executable()
37
39
nodejs()
38
40
}
@@ -41,22 +43,40 @@ kotlin {
41
43
jsMain {
42
44
dependencies {
43
45
implementation(libs.kotlinx.coroutines.core)
44
- implementation(dependencies.platform(libs.kotlin.wrappers.bom))
45
- implementation(libs.kotlin.wrapper.actions.toolkit)
46
- implementation(libs.kotlin.wrapper.js)
47
- implementation(libs.kotlin.wrapper.node)
48
- implementation(npm(libs.semver))
49
- implementation(npm(libs.nullWritable))
46
+ implementation(libs.ktor.client.core)
47
+ implementation(libs.ktor.client.js)
48
+ implementation(kotlinWrappers.actions.toolkit)
49
+ implementation(kotlinWrappers.js)
50
+ implementation(kotlinWrappers.node)
51
+ implementation(kotlinWrappers.semver)
52
+ implementation(kotlinWrappers.nullWritable)
50
53
}
51
54
}
52
55
}
53
56
}
54
57
55
- // work-around for https://youtrack.jetbrains.com/issue/KT-56305
56
58
tasks.withType<IncrementalSyncTask >().configureEach {
59
+ // work-around for https://youtrack.jetbrains.com/issue/KT-56305
57
60
doFirst {
58
61
outputs.files.forEach { it.deleteRecursively() }
59
62
}
63
+
64
+ // work-around for https://youtrack.jetbrains.com/issue/KTOR-6158
65
+ doLast {
66
+ outputs
67
+ .files
68
+ .asFileTree
69
+ .filter { it.name == " setup-wsl.mjs" }
70
+ .forEach {
71
+ it
72
+ .readText()
73
+ .replace(" eval('require')('abort-controller')" , " globalThis.AbortController" )
74
+ .replace(" eval('require')('node-fetch')" , " globalThis.fetch" )
75
+ .replace(" function readBodyNode(" , " function _readBodyNode(" )
76
+ .replace(" readBodyNode(" , " readBodyBrowser(" )
77
+ .apply (it::writeText)
78
+ }
79
+ }
60
80
}
61
81
62
82
val inputDefaultValues by lazy {
@@ -109,7 +129,7 @@ artifacts {
109
129
it
110
130
.destinationDirectory
111
131
.get()
112
- .resolve(" ${project.name} .js " )
132
+ .resolve(" ${project.name} .mjs " )
113
133
}
114
134
)
115
135
}
0 commit comments