os-lib icon indicating copy to clipboard operation
os-lib copied to clipboard

Include ScalaJS support

Open DamianReeves opened this issue 2 years ago • 4 comments

So os-lib has always been cool, but now that it is a member of the Scala toolkit, the fact that the library doesn't support ScalaJS seems like a wart. It would be great of ScalaJS support could be added.

And yes, I know that many file and process things won't work in the browser but NodeJS and deno are out there.

DamianReeves avatar Jul 11 '23 00:07 DamianReeves

Yeah. Scala.js support would be great. We gladly accept pull requests adding it.

lefou avatar Jul 11 '23 05:07 lefou

Yeah. Scala.js support would be great. We gladly accept pull requests adding it.

Is there a willingness to accept multiple PRs for this effort?

I would imagine, some parts may be fairly straightforward (i.e. Path related operations) and some others requiring different levels of effort. In my mind I see 3 main themes here: path, file I/O, and process support.

DamianReeves avatar Jul 11 '23 10:07 DamianReeves

Is there a willingness to accept multiple PRs for this effort?

I hope so (commenting as an observer not participant) — as long as the first PR merged adds a Scala.js section to the documentation that's clear about what works or doesn't.

SethTisue avatar Jul 11 '23 18:07 SethTisue

Yeah. Scala.js support would be great. We gladly accept pull requests adding it.

Is there a willingness to accept multiple PRs for this effort?

Of course. I thought, I said exactly that in the above quote.

I would imagine, some parts may be fairly straightforward (i.e. Path related operations) and some others requiring different levels of effort. In my mind I see 3 main themes here: path, file I/O, and process support.

That's fine as long as we document it. The PRs should be clear about their draft state, so that users know whether to expect stable or unstable Scala.JS API. Also some test coverage is required to maintain it.

lefou avatar Jul 12 '23 06:07 lefou

I think I'm going to call this a wontfix for now. The JS filesystem APIs are sufficiently different from JVM (e.g. being Async) that trying to unify them would be a whole research project on its own.

Users are still free to send PRs proposing possible implementations, but for now let's not track this as an active issue

lihaoyi avatar Jul 15 '24 03:07 lihaoyi

I really don't know enough about JS sync vs async, but there seem to be synchronous versions of some of the APIs: https://nodejs.org/api/fs.html#synchronous-api perhaps enough to implement rudimentary support of filesystem at least

keynmol avatar Oct 03 '24 11:10 keynmol