Sketch-sh/sketch-sh

[Bucklescript] Which external packages will be supported by Sketch

thangngoc89 opened this issue · 8 comments

So after painfully and manually packing ReasonReact for the playground #237, here are a few requirements for packages to be supported by Sketch:

  • MUST be buildable with bs-platform@5.0.6 . Yes. It's a fixed version because of bucklescript requirements. Since adding new compiler version support is painful and no automation (yet), I will probably stick with this version for a while.
  • MUST have namespace = false in bsconfig.
  • MUST not reference to any local files (js/css/...). This is not a requirement from me actually, relative paths inside your package won't work with bs-platform anyway.
  • SHOULD use src as source folder. This will probably be changed in the future when I build the ability to read bsconfig into the dependencies builder, but for the sake of simplicity, just put everything inside src.

If you think your packages satisfy those conditions, please send a PR to add it here

https://github.com/Sketch-sh/sketch-sh/blob/engine_bs/engine_bs/packages/package.json

Timeline:

  • Not immediately, but will be in the near future.

With respect to namespace = false I just checked what it's doing in the docs and BS docs has this to say about it:

image

Since it's almost considered mandatory according to the docs, why does it need to be turned off for a package to be used in sketch?

Relevant conversation WRT namespace = false #245 (review)

@johnhaley81

Since it's almost considered mandatory according to the docs, why does it need to be turned off for a package to be used in sketch?

because it's an implementation details of bsb (the build tools).

in order to build it for sketch, I need access to the generated cmi and cmj that contains the namespace. bsb intentionally use invalid module names (have a dot in it) to avoid leaking implementation details.

Granted that I can replicate that behavior but:

  • it's complicated
  • I can't be sure it would be compatible with bsb's behaviors.

So the best thing to do would be asking bsb to change this. @Ostera asked this for bsdoc and there answer was no. IIRC

Hey!
Is bucklescript supported then? I can't see any way to access Js namespace. Or I am misunderstanding something?

@danielo515 hey. this is a very old issue. Bucklescript doesn't exists anymore so I'm closing this.

@thangngoc89 I just tried to follow the same naming as the original message. Bucklescript still exists, even if it is an old version, and still allows to transpile to JS.
What is sketch using now? Or does it not transpile to JS? If it is using rescript, my question is still the same, will ti be possible to load external modules?

@danielo515 there used to be a site called nit.sketch.sh that works just like a buckelscript playground but it can evaluate the JS code (even DOM stuff). It actually predated the current playground offered by Rescript. I'm not sure about the current situation of rescript and I actually forgot where is the source code of nit