purescript-spec/purescript-spec-discovery

Support running PSCI in a browser

Closed this issue ยท 3 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.

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.

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 :)

Closing this due to 5 years of inactivity.