planck

Planck ClojureScript REPL
2017-12-15T01:45:31.000299Z

I'm feeling lazy and didn't search for longer than 3 minutes:

2017-12-15T01:45:42.000117Z

Can I import NPM or node modules via Planck?

mfikes 2017-12-15T02:14:06.000190Z

@tbaldridge No… Planck is based on plain JavaScriptCore and doesn’t have support for js/require. You should be able to do this in Lumo, though. It is actually based on Node.

2017-12-15T02:16:47.000015Z

thanks for the info!

mfikes 2017-12-15T02:17:21.000173Z

No problem. At times I’ve thought about implementing it in Planck. I haven’t done any research to see how much would be involved.

mfikes 2017-12-15T02:20:17.000148Z

I suppose the real killer would be, even if Planck could successfully load some JavaScript properly via js/require, then that JavaScript might expect other Node capabilities to be available in the ambient environment, like the filesystem and process stuff. The Node API would be a huge thing to replicate.

2017-12-15T12:02:52.000349Z

I guess planck could easily run compiled node moules, or import CommonJs files?

2017-12-15T12:04:12.000196Z

But yeh, as soon as a module requires fs/url or what have you, id would fail I guess.

mfikes 2017-12-15T12:08:03.000233Z

Yeah, it looks like implementing Node's module system might not be out of reach. That would let Planck successfully load things like https://www.npmjs.com/package/long

2017-12-15T12:21:29.000312Z

I was patching the require for a pr for lumo, didn't seem super complicated the logic here https://github.com/hlolli/lumo/blob/bb79bf95784a3d0fee76a65e23b5c889d22be406/scripts/requirePatch.js

2017-12-15T12:23:40.000127Z

if it's just compiling index.js in commonjs (main from package.json) into cljs environment it's not, but as soon as it's useing node binaries or something fancy, it gets quickly hard I guess.