purescript-spec-discovery icon indicating copy to clipboard operation
purescript-spec-discovery copied to clipboard

Support running PSCI in a browser

Open vyorkin opened this issue 6 years ago • 2 comments

Hello, first of all, I want to say thank you for the cool package! 👍

I've just noticed one small issue. It looks like it doesn't play well together with pulp psci --port 8080, which is useful (evals compiled js in a browser).

error1

Here is the repo which reproduces the issue mentioned above. I've also left some instructions in README.

vyorkin avatar Apr 03 '18 21:04 vyorkin

Thanks! Yes, this package only supports NodeJS environments right now. I had some ideas about using Webpack and its API (can't remember the name) to do some kind of reflection on the bundled modules, but I'm not working on this anymore and have no time for it. Also, I don't know if that Webpack approach would work with pulp psci server command.

If you'd be interested in trying to extend support to browser environments, I'd accept a PR.

owickstrom avatar Apr 04 '18 05:04 owickstrom

Smth like this could work: https://github.com/garyb/purescript-debug/blob/master/src/Debug/Trace.js#L4 (the basic idea) You're already checking if require is undefined, so maybe instead of throwing an error we can just return an empty array of specs in that case?

UPD: Ok, I see, it actually breaks earlier, at import Node.FS here, because https://github.com/purescript-node/purescript-node-fs/blob/6a1651cb16ad77c2e9d7f64f7ea10d3ec129b14c/src/Node/FS/Stats.js#L3. I have no idea how to fix this for now :)

vyorkin avatar Apr 27 '18 15:04 vyorkin

Closing this due to 5 years of inactivity.

fsoikin avatar Jul 20 '23 19:07 fsoikin