Vampire
10/16/2022, 3:08 AMDict
subinterface that I need to give as argument, how do I properly construct it?
In this case it is the external interface OutgoingHttpHeaders : Dict<dynamic /* Number | String | Array<String> */>
from kotlinx-nodejs
turansky
10/16/2022, 4:43 PMVampire
10/17/2022, 3:36 PMkotlin-node
is kind of successor of koltinx-nodejs
I guess?
Well keep in mind when I go to newer Node.
I guess the kotlin-node
version corresponds to the Node.js version?
Because currently I'm on Node.js 12 and only have the choice between 12 and 16, as it is about a GitHub Action.
For now I solved it using
fun Map<String, Any>.asOutgoingHttpHeaders() = asDynamic().unsafeCast<OutgoingHttpHeaders>()
turansky
10/17/2022, 3:43 PMAh, soIn some wayis kind of successor ofkotlin-node
I guess?koltinx-nodejs
turansky
10/17/2022, 3:44 PMI guess theversion corresponds to the Node.js version?kotlin-node
@types/node
version usedturansky
10/17/2022, 3:45 PMBecause currently Iβm on Node.js 12 and only have the choice between 12 and 16, as it is about a GitHub Action.16 - current LTS π
turansky
10/17/2022, 3:45 PMFor now I solved it using
Copy codefun Map<String, Any>.asOutgoingHttpHeaders() = asDynamic().unsafeCast<OutgoingHttpHeaders>()
Map
!= Record
(JSO)Vampire
10/17/2022, 3:54 PM16 - current LTS πWhen I wrote the action only 12 was available. π€·
Well, it works as expected according to my tests. :-)!=Map
(JSO)Record
turansky
10/17/2022, 3:57 PMMap
- Kotlin Map?Vampire
10/17/2022, 3:59 PMturansky
10/17/2022, 4:04 PMVampire
10/17/2022, 4:08 PMfun Map<String, Any>.asIHeaders() = asDynamic().unsafeCast<IHeaders>()
that I created with the help of you afair πVampire
10/17/2022, 4:13 PMasDynamic
π
fun Map<String, Any>.asOutgoingHttpHeaders() = asDynamic().unsafeCast<OutgoingHttpHeaders>()
fun <V> Map<String, V>.asDynamic() = jsObject<dynamic> {
for ((name, value) in this@asDynamic) {
this[name] = value
}
}
turansky
10/19/2022, 12:34 AMwhen Node.js 18 enters long-term support (LTS) later this monthhttps://nodejs.org/en/blog/announcements/v19-release-announce/
turansky
10/19/2022, 12:38 AMkotlin-wrappers
we provide many additional types for strict JS interop. As result - you can avoid asDynamic()
and unsafeCast()
usages (like in case above π)Vampire
11/13/2022, 1:18 AMturansky
11/13/2022, 2:51 AMButWe support Node 16 as minimum versionjust provides node 17 and node 18.kotlin-node
So what should I use for node 16?In case of wrappers 18 = 16+ You will see some new API, but most of them marked with
@since
tag
And btw. will kotlin-node ever leave pre-state? πYes, when we will find better versioning scheme for our use case (NPM version + wrappers build or version). Do you have ideas? π
Vampire
11/13/2022, 2:58 AMWe support Node 16 as minimum versionOh really? But I only have seen 17 and 18 versions on Maven Central
In case of wrappers 18 = 16+
You will see some new API, but most of them marked withOh, I see, great. I thought you need the version matching your node version. Then I'll probably switch of course. For now it actually worked without any code change and just changing node version to 16 πtag@since
Do you have ideas?Probably none you didn't have yet. <npm version>-<your release as increasing number> or something like that. But maybe I just cannot think, it's 4 AM. Just wanted to quickly get rid of the issue ticket. π
turansky
11/15/2022, 1:05 PMsuspend
adapters for converted promise API in kotlin-node
. For example for fs
module APIVampire
11/15/2022, 1:12 PMturansky
11/15/2022, 1:14 PMVampire
11/15/2022, 1:16 PMmkdirSync
in kotlinx-nodejs
, isn't it?turansky
11/15/2022, 1:21 PMmkdirSync
- synchronous API
Inside mkdir
we use asynchronous API (mkdirAsync
)Vampire
11/15/2022, 1:22 PMmkdir
, isn't it?
Or what do I miss? πVampire
11/15/2022, 1:24 PMPromise
and you abstract that away πVampire
01/27/2023, 11:17 AM...-compat
versions?turansky
01/27/2023, 2:09 PMkotlin.mpp.enableCompatibilityMetadataVariant=true
option.Vampire
01/27/2023, 2:11 PMVampire
01/27/2023, 2:13 PMkotlin-extensions
and kotlinx-nodejs
to kotlin-js
and kotlin-node
, so I might come back with some more question if you don't mind. πVampire
01/27/2023, 2:14 PMOutgoingHttpHeaders
I was now able to do using
additionalHeaders = Record<String, String> {
set("Content-Type", "application/x-www-form-urlencoded")
}
That's the intended way and what you meant, correct?turansky
01/27/2023, 2:19 PMadditionalHeaders = recordOf(
"Content-Type" to "application/x-www-form-urlencoded",
)
Vampire
01/27/2023, 2:21 PMVampire
01/27/2023, 2:23 PMexec(...)
from @actions/exec
.
That needs an ExecOptions
so I now do options = jso { ... }
instead of options = jsObject { ... }
, right?Vampire
01/27/2023, 2:26 PMExecOptions
need (or I need to set it) env
of type tsstdlib.T$2
which comes from lib.es5.kt
and is defined as
external interface `T$2` {
@nativeGetter
operator fun get(key: String): String?
@nativeSetter
operator fun set(key: String, value: String)
}
What is the correct way here?
In approximation of my old code mentioned above, I'd guess
env = Record<String, String> {
set("DEBIAN_FRONTEND", "noninteractive")
set("WSLENV", "DEBIAN_FRONTEND/u")
}.unsafeCast<`T$2`>()
?turansky
01/27/2023, 2:28 PMT$2
is effectively Record
- could you replace it?Vampire
01/27/2023, 2:30 PMturansky
01/27/2023, 2:32 PMReadonlyRecord
looks like better replacement πturansky
01/27/2023, 2:32 PMrecordOf
will return itVampire
01/27/2023, 2:34 PMExecOptions
replace
var env: `T$2`?
get() = definedExternally
set(value) = definedExternally
by
var env: js.core.ReadonlyRecord<String, String>?
right?turansky
01/27/2023, 2:34 PMturansky
01/27/2023, 2:35 PMMap
-> ReadonlyRecord
MutableMap
-> Record
Vampire
01/27/2023, 2:46 PMenv = Record {
without type arguments πturansky
01/27/2023, 2:46 PMrecordOf
is readyturansky
01/27/2023, 2:46 PMpre.488
turansky
01/27/2023, 2:47 PMGreat, now I can even dowithout type arguments πenv = Record {
recordOf
Vampire
01/27/2023, 2:48 PMVampire
01/27/2023, 2:48 PMnode.fs.readdir
?Vampire
01/27/2023, 3:20 PMhttp.IncomingMessage
, http.OutgoingHttpHeaders
, url.URL
, and so on which are all in other packages now.
Or do I need to add the import-fixing to my post-processing step?turansky
01/27/2023, 3:24 PMVampire
01/27/2023, 3:25 PMimplementation(npm("@actions/cache"))
implementation(npm("@actions/core"))
implementation(npm("@actions/exec"))
implementation(npm("@actions/http-client"))
implementation(npm("@actions/io"))
implementation(npm("@actions/tool-cache"))
implementation(npm("@types/semver"))
implementation(npm("semver", generateExternals = false))
implementation(npm("null-writable"))
implementation(npm("@vercel/ncc", generateExternals = false))
turansky
01/27/2023, 3:25 PMHm, where isAs quick fix - PR in?node.fs.readdir
kotlin-node
(with manual declarations) + issueVampire
01/27/2023, 3:26 PMturansky
01/27/2023, 3:26 PMVampire
01/27/2023, 3:27 PMreaddirSync
or readdirAsync
, but it seems all are missing.
exists
is also missing, but at least existsSync
is available.turansky
01/27/2023, 3:28 PMVampire
01/27/2023, 3:29 PMVampire
01/28/2023, 12:41 PMVampire
01/28/2023, 12:43 PMAnd is there some way to make Dukat use the new wrappers classes?
Now various of the generated classes use,http.IncomingMessage
,http.OutgoingHttpHeaders
, and so on which are all in other packages now.url.URL
Or do I need to add the import-fixing to my post-processing step?
Which NPM libraries do you need?
``` implementation(npm("@actions/cache"))
implementation(npm("@actions/core"))
implementation(npm("@actions/exec"))
implementation(npm("@actions/http-client"))
implementation(npm("@actions/io"))
implementation(npm("@actions/tool-cache"))
implementation(npm("@types/semver"))
implementation(npm("semver", generateExternals = false))
implementation(npm("null-writable"))
implementation(npm("@vercel/ncc", generateExternals = false))```So, ...? π
turansky
01/28/2023, 3:34 PMAnd is there some way to make Dukat use the new wrappers classes?AFAIK Dukat is freezed right now π
turansky
01/28/2023, 3:44 PM@actions/...
libraries look like good candidates for kotlin-wrappers
Issue will be fine start point, especially if you are ready to test results πturansky
01/28/2023, 3:47 PMhttps://github.com/JetBrains/kotlin-wrappers/issues/1889Could you list all missed methods, which you found?
Vampire
01/28/2023, 4:11 PMAFAIK Dukat is freezed right nowSo no No problem, I'll simply do it in my post-processing. Actually, it should unfreeze now. At least it was always said that it is freezed until IR is stable which it is now with 1.8.
libraries look like good candidates for@actions/...
kotlin-wrappers
Issue will be fine start point, especially if you are ready to test results πNice. :-) Here you have it: https://github.com/JetBrains/kotlin-wrappers/issues/1891 Of course I'm willing to test, as I use almost all of them anyway already and have extensive tests for my action.
> https://github.com/JetBrains/kotlin-wrappers/issues/1889
Could you list all missed methods, which you found?I did.
readdirSync
was the only one I used for which I did not find a replacement.Vampire
01/28/2023, 5:24 PMwriteFile
previously allowed to set the mode for the file, but now only the encoding can be set π
https://github.com/JetBrains/kotlin-wrappers/issues/1893turansky
01/28/2023, 6:31 PMpre.488
released!
recordOf
is available πVampire
01/28/2023, 6:38 PMturansky
01/28/2023, 6:39 PMturansky
01/28/2023, 6:40 PMVampire
01/29/2023, 12:23 AMOutgoingHttpHeaders
I cannot use the recordOf
factory as it complains because OutgoingHttpHeaders
is an alias for Dict<Any /* OutgoingHttpHeader */>
which is an alias for Record<String, Any /* OutgoingHttpHeader */>
so it does not accept the ReadonlyRecord
turansky
01/29/2023, 1:32 AMturansky
01/29/2023, 3:21 AMpre.489
turansky
01/29/2023, 5:58 PMVampire
01/29/2023, 7:34 PMmode
of type Mode
and flag
of type OpenMode
,
but the interface containing them is called FlagAndOpenMode
which both just refer to the second property. πturansky
01/29/2023, 7:40 PMVampire
01/29/2023, 7:57 PM...Sync
method, existsSync
which is the only one you have in the wrapper.
Should there be an existsAsync
and therefor a suspend exists
?Vampire
01/29/2023, 8:08 PMGood news - we have single source for all plaforms! πhttps://github.com/DefinitelyTyped/DefinitelyTyped/discussions/64140
turansky
01/29/2023, 8:10 PMAh, damn, maybe one more.Donβt stop! π
turansky
01/29/2023, 8:13 PMexists
described in headerVampire
01/29/2023, 8:16 PMexists
returning a promise does not exist as it is not in promises.d.ts
β’ existsSync
does exist and is also supported
β’ exists
in an async way only exists with callbacks and these are deprecated and should be replaced by stat
or access
Correct?Vampire
01/29/2023, 8:22 PMfs.access
instead.
But node.fs.access
in the wrapper returns Unit
πturansky
01/29/2023, 8:24 PMturansky
01/29/2023, 8:25 PMstat
looks like best async variantVampire
01/29/2023, 8:32 PMstat
tell to use access
for pure file-exists check πVampire
01/29/2023, 8:32 PMsuspend fun exists(path: PathLike) = runCatching {
access(path)
true
}.getOrDefault(false)
turansky
01/29/2023, 8:42 PMsuspend fun exists(path: PathLike): Boolean =
accessAsync(path)
.then { true }
.catch { false }
.await()
Vampire
01/29/2023, 8:44 PMVampire
01/29/2023, 8:45 PMVampire
01/29/2023, 8:45 PMVampire
01/29/2023, 9:06 PMVampire
01/29/2023, 9:08 PMError: No such built-in module: node:test
at new NodeError (node:internal/errors:372:5)
at Function.Module._load (node:internal/modules/cjs/loader:785:13)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.2008 (D:\a\setup-wsl\setup-wsl\build\webpack:\setup-wsl-ncc-packer\external node-commonjs "node:test":1:1)
at __nccwpck_require__ (D:\a\setup-wsl\setup-wsl\build\webpack:\setup-wsl-ncc-packer\webpack\bootstrap:21:1)
at Object.6166 (D:\a\setup-wsl\setup-wsl\build\node_modules\kotlin-node\kotlin-node.js:2070:1)
at __nccwpck_require__ (D:\a\setup-wsl\setup-wsl\build\webpack:\setup-wsl-ncc-packer\webpack\bootstrap:21:1)
at Object.4624 (D:\a\setup-wsl\setup-wsl\build\webpack:\setup-wsl\kotlin\setup-wsl.js:3364:1)
at __nccwpck_require__ (D:\a\setup-wsl\setup-wsl\build\webpack:\setup-wsl-ncc-packer\webpack\bootstrap:21:1)
Any idea where that might come from?turansky
01/29/2023, 10:09 PMturansky
01/29/2023, 10:10 PMnode:test
is from Node 18Vampire
01/29/2023, 10:44 PMVampire
01/29/2023, 10:44 PMVampire
01/29/2023, 10:45 PMVampire
01/29/2023, 10:46 PMncc
version, if I update that separately first, the project still runs as expected.Vampire
01/29/2023, 10:48 PMturansky
01/29/2023, 11:15 PMItβs also not theWhat does it mean?versionncc
turansky
01/29/2023, 11:16 PMYes, that project is still on Kotlin 1.4.Magic π
Vampire
01/29/2023, 11:18 PMncc
failed to run.
So I updated ncc
along to see whether it helps and then the ncc
run worked.
But now the execution of the result fails.
I now reverted all changes and only updated ncc
first to see whether it fails or not, but with that it still works as expected.turansky
01/29/2023, 11:19 PMncc
?Vampire
01/29/2023, 11:19 PMVampire
01/29/2023, 11:20 PMturansky
01/29/2023, 11:20 PMVampire
01/29/2023, 11:21 PMturansky
01/29/2023, 11:24 PMnode:test
in your case) // recommended
2. Configure webpack fallback for node:test
if itβs possibleturansky
01/29/2023, 11:26 PMturansky
01/29/2023, 11:28 PMnode:test
import in Gradle task πVampire
01/29/2023, 11:34 PMturansky
01/29/2023, 11:51 PMWith 3. you mean a post-processing of the ncc result?I mean post-processing of Kotlin compilation result Itβs what you can find in
build/js/packages/%your-package%
Vampire
01/29/2023, 11:55 PMfind build/js/packages/setup-wsl -type f -exec grep node:test {} +
does not find any result thoughVampire
01/30/2023, 12:05 AMVampire
01/31/2023, 1:05 AMcompileProductionExecutableKotlinJs
and compileDevelopmentExecutableKotlinJs
.
But I don't find info about them in the docs.
Or productionExecutableCompileSync
and devleopmentExecutableCompileSync
.Vampire
01/31/2023, 1:07 AMrun
did run nodeRun
and the docs still say it does.
But now run
runs nodeRun
, nodeProductionRun
, and nodeDevelopmentRun
.Vampire
01/31/2023, 1:48 AMcompileKotlinJs
- *.kt
=> IR
compileDevelopmentExecutableKotlinJs
- IR => JS without DCE
compileProductionExecutableKotlinJs
- IR => JS with DCE
developmentExecutableCompileSync
- JS without DCE + resources => to other folder
productionExecutableCompileSync
- JS with DCE + resources => to other folder
nodeRun
- Runs the result of developmentExecutableCompileSync
nodeDevelopmentRun
- Also runs the result of developmentExecutableCompileSync
nodeProductionRun
- Runs the result of productionExecutableCompileSync
While I think it is very suboptimally solved that the ...CompileSync
tasks are Copy
tasks, not Sync
tasks, and that they also have the same output directory.
Will create an issue about that.Vampire
01/31/2023, 2:22 AMVampire
02/02/2023, 8:15 PMbuildSrc
I long postponed due to other stuff
and thereby cleaning up some really ugly stuff did in the past in that build, rewriting half of the build. π
And as a side-effect fixed invalid tests that were successful do the wrong reason. :-D
Now the end result is immediately just 6.3 MiB instead of 14 MiB. :-)turansky
02/02/2023, 9:34 PMVampire
02/02/2023, 10:32 PMturansky
02/02/2023, 11:05 PMVampire
02/03/2023, 12:23 AMVampire
02/03/2023, 2:21 AMVampire
02/03/2023, 12:30 PMnodeRun
or nodeDevelopmentRun
, it fails with
D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:25473
}(module.exports, require('semver'), require('node:fs/promises'), require('null-writable'), require('node:path'), require('node:os'), require('node:process')));
^
ReferenceError: AbstractCoroutineContextElement is not defined
at D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:454:73
at Object.<anonymous> (D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:25473:2)
at Module._compile (node:internal/modules/cjs/loader:1152:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47
π
Any idea where this might come from and / or how to fix it?turansky
02/04/2023, 10:36 PMcoroutines
version?Vampire
02/05/2023, 4:05 PMorg.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4
Vampire
02/05/2023, 4:05 PMturansky
02/05/2023, 5:41 PMVampire
02/05/2023, 6:06 PMVampire
02/05/2023, 6:06 PMturansky
02/05/2023, 8:32 PMwhole-program
granularity? π§Vampire
02/05/2023, 10:15 PMturansky
02/05/2023, 10:24 PMAbstractCoroutineContextElement
really missed in development build?Vampire
02/05/2023, 11:28 PM$ grep AbstractCoroutineContextElement build/compileSync/js/main/developmentExecutable/kotlin/setup-wsl.js
setMetadataFor(CoroutineDispatcher, 'CoroutineDispatcher', classMeta, AbstractCoroutineContextElement, [AbstractCoroutineContextElement, ContinuationInterceptor], undefined, undefined, []);
setMetadataFor(YieldContext, 'YieldContext', classMeta, AbstractCoroutineContextElement, undefined, undefined, undefined, []);
AbstractCoroutineContextElement.call(this, Key_getInstance());
AbstractCoroutineContextElement.call(this, Key_getInstance_3());
Vampire
02/05/2023, 11:29 PMfoo
of https://github.com/Vampire/setup-wslVampire
02/05/2023, 11:46 PM$ grep AbstractCoroutineContextElement build/compileSync/js/main/productionExecutable/kotlin/setup-wsl.js
setMetadataFor(AbstractCoroutineContextElement, 'AbstractCoroutineContextElement', classMeta, undefined, [Element], undefined, undefined, []);
setMetadataFor(CoroutineDispatcher, 'CoroutineDispatcher', classMeta, AbstractCoroutineContextElement, [AbstractCoroutineContextElement, ContinuationInterceptor], undefined, undefined, []);
function AbstractCoroutineContextElement(key) {
AbstractCoroutineContextElement.prototype.w = function () {
AbstractCoroutineContextElement.call(this, Key_getInstance());
AbstractCoroutineContextElement.prototype.m2 = get;
AbstractCoroutineContextElement.prototype.s2 = fold;
AbstractCoroutineContextElement.prototype.r2 = minusKey;
AbstractCoroutineContextElement.prototype.t2 = plus;
turansky
02/06/2023, 12:21 AMmain
:
(AbstractCoroutineContextElement::class.js)
as workaround works for you?turansky
02/06/2023, 12:36 AM1.8.10
) and Kotlinx Serialization plugin (1.7.10
) . Why?Vampire
02/06/2023, 12:38 AMVampire
02/06/2023, 12:38 AMVampire
02/06/2023, 12:39 AMaction.yml
file and to write a file in the sub-builds that I read in the root buildVampire
02/06/2023, 12:41 AMVampire
02/06/2023, 12:41 AMD:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:31451
}(module.exports, require('node:fs/promises'), require('@actions/http-client'), require('@actions/core'), require('@actions/exec'), require('semver/classes/semver'), require('null-writable'), require('node:path'), require('node:os'), require('@actions/tool-cache'), require('@actions/cache'), require('node:process'), require('@actions/io')));
^
ReferenceError: CancellationException is not defined
at D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:627:91
at Object.<anonymous> (D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:31451:2)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47
Vampire
02/06/2023, 12:48 AM(CancellationException::class.js)
, then it at least starts to run but then fails with
> Task :nodeDevelopmentRun FAILED
::group::Verify Windows Environment
::endgroup::
::debug::ReferenceError: intercepted is not defined%0A at await_0 (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\common\src\CancellableContinuation.kt:315:27)%0A at $verifyWindowsEnvironmentCOROUTINE$4.doResume_5yljmg_k$ (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:345:26)%0A at verifyWindowsEnvironment (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:341:9)%0A at verifyWindowsEnvironment$ref.invoke_pbb09x_k$ (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:271:45)%0A at $groupCOROUTINE$3.l [as fn_1] (D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:30474:16)%0A at $groupCOROUTINE$3.doResume_5yljmg_k$ (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:335:16)%0A at group (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:332:9)%0A at $mainCOROUTINE$0.doResume_5yljmg_k$ (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:271:9)%0A at main (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:266:9)%0A at D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:31495:3%0A
::error::intercepted is not defined
Vampire
02/06/2023, 12:50 AMturansky
02/06/2023, 1:49 AMSymbol
, we have it in browser API and we have it in coroutines
.turansky
02/06/2023, 1:50 AMkotlin-actions-toolkit
release tomorrow.
Probably it will simplify future checks.turansky
02/06/2023, 1:51 AMper-module
granularity it also doesnβt work, right? π€Vampire
02/06/2023, 1:57 AMturansky
02/06/2023, 7:27 PMkotlin-actions-toolkit
released πVampire
02/07/2023, 1:46 AMVampire
02/07/2023, 1:47 AMPromise
returning methods are suffixed with Async
and that there is a suspend
one that awaits that promise.turansky
02/07/2023, 1:23 PMcoroutines
in dev mode.Vampire
02/07/2023, 1:54 PMturansky
02/08/2023, 11:42 PMHm, I almost expected the same pattern like for the Node.js stuff.Are you talking about top level functions only?
Vampire
02/08/2023, 11:43 PMturansky
02/08/2023, 11:45 PMsuspend
wrappers only for top level functions (mkdir
, readFile
)turansky
02/08/2023, 11:47 PM@actions/*
looks like you want moreturansky
02/08/2023, 11:47 PMHttpClient
methodsVampire
02/08/2023, 11:50 PMpost
and readBody
) are indeed the only non-top-level I use.
What is the reasoning to only do it for the top-level methods in node?turansky
02/09/2023, 12:01 AMinline
sugar you wonβt see it in default suggestion from IDEAVampire
02/09/2023, 12:21 AMVampire
02/09/2023, 3:24 PMturansky
02/09/2023, 6:32 PM1.8.20-beta
?Vampire
02/09/2023, 6:40 PMVampire
02/09/2023, 7:13 PMVampire
02/09/2023, 7:13 PMVampire
02/09/2023, 7:18 PMAbstractCoroutineContextElement
error.
So it seems to indeed be a Kotlin/JS bug that will be fixed with 1.8.20.
Thanks for the help in figuring out.Vampire
02/09/2023, 7:53 PMimport node.stream.Writable
@JsModule("null-writable")
@JsNonModule
external class NullWritable : Writable
?
::debug::TypeError: NullWritable is not a constructor%0A at wslHelp$slambda.gc (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:77:25)%0A at wslHelp$slambda.n11 (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:67:47)%0A at l (D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:13007:16)%0A at _no_name_provided__qut3iv_2.gc (D:\Sourcecode\other\setup-wsl\build\compileSync\js\main\productionExecutable\kotlin\src\kotlin\coroutines_13\IntrinsicsJs.kt:163:40)%0A at _no_name_provided__qut3iv_2.CoroutineImpl.r7 (D:\Sourcecode\other\setup-wsl\build\compileSync\js\main\productionExecutable\kotlin\commonMainSources\libraries\stdlib\src\kotlin\util\Standard.kt:55:40)%0A at _no_name_provided__qut3iv_2.CoroutineImpl.j2 (D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:7214:17)%0A at <http://DispatchedContinuation.DispatchedTask.gh|DispatchedContinuation.DispatchedTask.gh> (D:\Sourcecode\other\setup-wsl\build\compileSync\js\main\productionExecutable\kotlin\commonMainSources\libraries\stdlib\src\kotlin\coroutines\Continuation.kt:45:5)%0A at <http://ScheduledMessageQueue.MessageQueue.no|ScheduledMessageQueue.MessageQueue.no> (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\js\src\JSDispatcher.kt:153:25)%0A at D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\js\src\JSDispatcher.kt:19:48%0A at processTicksAndRejections (node:internal/process/task_queues:78:11)%0A
::error::NullWritable is not a constructor
πturansky
02/09/2023, 8:06 PMVampire
02/09/2023, 8:08 PM@JsModule("semver/classes/semver")
external class SemVer(version: String, options: RangeOptions)
external interface RangeOptions
though, or do I need to use file annotation there too?Vampire
02/09/2023, 8:14 PMVampire
02/09/2023, 8:14 PMVampire
02/09/2023, 8:29 PMVampire
02/09/2023, 8:41 PM9 files changed, 45 insertions(+), 575 deletions(-)Now Dukat is eliminated from my build, many boilerplate removed (and most additions are copyright), no time-waste for running Dukat or compiling the Kotlin classes and it works with 1.8.20-Beta. π So yeah, if I in the current state just change 1.8.10 to 1.8.20-Beta, the dev-run suddenly works. π
turansky
02/09/2023, 10:13 PMsuspend
wrappers πturansky
02/09/2023, 11:54 PMOne day I should learn to understand that πThere 2 main variants:
// #1 Named import
// JS
import { Vampire } from "vampire"
// Kotlin
@file:JsModule("vampire")
external val Vampire
------------------------------
// #2 Default import
// JS
import Vampire from "vampire"
// Kotlin
@file:JsModule("vampire")
@JsName("default")
external val Vampire
turansky
02/09/2023, 11:55 PM@JsNonModule
is redundant for Node, because you need modular format in any caseturansky
02/09/2023, 11:59 PMJsImport
already requested - feel free to vote πVampire
02/10/2023, 7:58 AMLooks like you are ready for more suspend wrappers π
Always :-)
There 2 main variants:
Thanks
FYI - @JsNonModule is redundant for Node, because you need modular format in any case
Ah, ok, will remove it, thanks. Basically looked at what Dukat had produced. :-)
feel free to vote π
Done :-)
Vampire
02/12/2023, 10:12 PMLooks like you are ready for more suspend wrappersShould I find them already and am just blind? I updated to the new version and see that now there is
execAsync
and alike, but I don't find the suspend versions.
Or is that yet again another step? πVampire
02/13/2023, 2:20 AM...Async
methods work fine too, anyway πVampire
02/13/2023, 8:02 AMturansky
02/13/2023, 12:52 PMTheFine On next step I will generatemethods work fine too, anyway π...Async
suspend
adaptersturansky
02/13/2023, 12:54 PMturansky
02/15/2023, 2:48 AMVampire
02/15/2023, 10:58 AM```suspend fun exists(path: PathLike): Boolean =
accessAsync(path)
.then { true }
.catch { false }
.await()```Actually I'm just blind, there is
actions.io.exists
ready to use πturansky
02/15/2023, 11:09 AMturansky
02/15/2023, 11:09 AMVampire
02/15/2023, 11:13 AMVampire
02/15/2023, 12:39 PMVampire
02/15/2023, 12:40 PMVampire
02/15/2023, 12:41 PMTypeError: exists is not a function%0A at exists_0 (D:\Users\leonid.khachaturov\code\kotlin-wrappers-new\kotlin-actions-toolkit\src\jsMain\generated\actions\io\exists.kt:10:5)%0A
at $mainCOROUTINE$<http://11.ec|11.ec> (D:\Sourcecode\other\setup-wsl\src\main\kotlin\net\kautler\github\action\setup_wsl\SetupWsl.kt:287:17)%0A at $verifyWindowsEnvironmentCOROUTINE$15.CoroutineImpl.r7 (D:\Sourcecode\other\setup-wsl\build\compileSync\js\main\productionExecutable\kotlin\commonMainSources\libraries\stdlib\src\kotlin\util\Standard.kt:55:40)%0A at $verifyWindowsEnvironmentCOROUTINE$15.CoroutineImpl.j2 (D:\Sourcecode\other\setup-wsl\build\js\packages\setup-wsl\kotlin\setup-wsl.js:6918:17)%0A at resume (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\common\src\internal\DispatchedTask.kt:178:26)%0A at dispatch (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\common\src\internal\DispatchedTask.kt:166:9)%0A
at dispatchResume (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\common\src\CancellableContinuationImpl.kt:397:9)%0A at resumeImpl (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\common\src\CancellableContinuationImpl.kt:431:21)%0A at resumeImpl$default (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\common\src\CancellableContinuationImpl.kt:420:13)%0A at CancellableContinuationImpl.j2 (D:\opt\teamcity-agent\work\44ec6e850d5c63f0\kotlinx-coroutines-core\common\src\CancellableContinuationImpl.kt:328:9)%0A
exists is not a function
Vampire
02/15/2023, 12:43 PMVampire
02/15/2023, 12:44 PMio-utils.ts
, not in io.ts
like the othersVampire
02/15/2023, 12:46 PMturansky
02/15/2023, 1:32 PMVampire
02/15/2023, 1:32 PMVampire
02/15/2023, 1:37 PMturansky
02/15/2023, 1:49 PMSure, will the fix be that it will be not available, or that it will work?Looks like it will be better to delete it
turansky
02/15/2023, 1:50 PMgenerated
sources for Nodeturansky
02/15/2023, 1:51 PMexistsAsync
and suspend exists
I will merge itVampire
02/15/2023, 2:03 PMexists
from Node itself?Vampire
02/15/2023, 2:05 PMexistsSync
representing that deprecated exists
turansky
02/15/2023, 2:07 PMexists
- with callback.
Your version will be without callback - no problem detected.Vampire
02/15/2023, 2:10 PMpackage node.fs
external fun existsSync(
path: PathLike,
): Boolean
Vampire
02/15/2023, 2:11 PMexists
with callback you don't even provide a wrapper, do you?Vampire
02/15/2023, 2:11 PMturansky
02/15/2023, 2:11 PMVampire
02/15/2023, 2:32 PMturansky
02/15/2023, 2:45 PMVampire
02/15/2023, 2:47 PMVampire
02/15/2023, 2:48 PMturansky
02/15/2023, 8:29 PMpre.498
is waiting for checks πVampire
02/15/2023, 11:17 PMVampire
02/16/2023, 7:59 AM