Closed Zizico2 closed 1 year ago
I did not try deno, but I suppose it should work without much hassle, do you have any particular issue? You can just download the npm package and check if it works
@bobzhang I opened an issue requesting ReScript support for Alephjs. One of their goals is to stay away from npm. https://github.com/alephjs/aleph.js/issues/159
I did not try deno, but I suppose it should work without much hassle, do you have any particular issue? You can just download the npm package and check if it works
@bobzhang Deno is not a Node thing, it is a whole another server side runtime. That would not work because while Node uses CJS we use native ES modules.
Note we support es6 modules, you can configure it like
"package-specs" : "es6" // "es6-global" for precise path
You don't need use npm, you can just use a http client to download bs-platform
, I am not sure how deno support packages
I made a repo to show how to use ReScript with Deno, you don't need do anything special with Deno since we support the ESModule standard https://github.com/bobzhang/rescript-deno
@bobzhang Yes that could work, but it is inconvenient when trying to use ReScript with frameworks like Aleph as many developers who use Deno try to limit the dependency on Node and NPM as much as possible.
@shadowtime2000 There is only one dependency: bs-platform, the package has no dependencies, you can just download the package by hand. Did I miss anything?
@bobzhang Yes, that most Deno developers wouldn't want to have to use Node alongside with Deno, but just Deno.
where is node used?
@bobzhang Well, you have to use NPM to install the bs-platform
package which Deno devs wouldn't like, and then the running of that build system requires Node.
What I am talking about is a bs-platform
package that uses Deno APIs to do the building.
@bobzhang Maybe I didn't clearly explain myself. I am talking about having support for the ReScript compiler itself inside Deno, and not having to use Node because it's kind of dumb to have to rely on Node to use Deno. I have no idea how ReScript compiler works but it seems like majority of it is native code so you could just write bindings to it using Deno's APIs.
Hey 👋 I too would be interested in knowing if it’s possible to publish the Rescript packages as Deno packages.
From what I was reading, Deno doesn’t seem to have a default package manager or registry. So that may mean that Rescript may need to compile to JS that uses import statements with remote paths like:
import * as Array from 'https://unpkg.com/bs-platform@9.0.2/lib/es6/array.js'
We could also use something like Trex (unofficial package manager) to provide Import Maps for something like:
import * as Array from 'bs-platform/array'
Another piece would be to provide Deno alternatives for scripts like bsb
, bsc
, and any other Node based executables. The APIs are different enough that this could require some extra Deno knowledge about how to install and use executables with Deno.
I would be happy to help experiment with some of this and see if we can put something together. I really think that Rescript could benefit from the Deno community, and that the Deno community would appreciate Rescript since they like TypeScript (officially supported by Deno) but at times would prefer an alternative type system and/or language 😊
cc @bobzhang
@seanstrom Hi, we are open contributions to make deno use experience better. Note only bsb is relevant, it is a small file that should be easy to adapt to deno
So I assume bsb is just some glue code to use child_process
to load the actual native compiler and use it. That should be relatively simple to recreate in Deno as it already has support for that with Deno.run
.
yes, if you don't use watch mode, bsb
is basically the same as bsb.exe
sitting in darwin/linux/win32
@seanstrom Hi, we are open contributions to make deno use experience better.
Great to hear 😊
Note only bsb is relevant, it is a small file that should be easy to adapt to deno
I have a question about the bsc
script, why it is not relevant? It seems like it also uses child_process
.
I also have some notes and questions around supporting Deno. Some of these comments are based on this Rescipt + Deno demo and the Rescript compiler internals.
node_modules
.
bs-platform
by URL after we officially publish the package on Deno.land.
bs-platform
separatelyhttps://deno.land/x/bs_platform@<version>
bs-platform
to bs_platform
for Deno’s registry.What are your thoughts on this? How should we add Deno support for the runtime modules from bs-platform
?
cc @bobzhang
I have a question about the bsc script, why it is not relevant?
Only the build system bsb
is client facing, it internally called bsc.exe directly. The cli of bsc is unstable and subject to change.
rename bs-platform to bs_platform
We are going to publish it as rescript
on npm, so it should not be an issue.
wants avoid using directories like node_modules.
You can try to use the module format es6-global. There may be some other issues
I created a fork of the Rescript + Deno experiment and added a Deno import map, along with the external-stdlib
setting in the bsconfig.json. The use of a import map makes it pretty easy to use Deno to download the Rescript standard library 😃
Here's the experiment with Rescript + Deno with import map file https://github.com/seanstrom/rescript-deno/tree/deno-import-map
Indeed import map is quite nice, I also made use of it here https://github.com/bobzhang/rescript-react-demo @seanstrom feel free to send a PR to if any changes are needed to make the experience better
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Are there any plans to support Deno? The Deno ecosystem is growing rapidly and we are stuck with JavaScript and TypeScript since bs-platform is only packaged as an npm package.