No unit tests yet for adapters but there are use-case tests for the
loader you can use. You can run the HelloWorld program until it succeeds
without downloading dependencies via node first. Just delete the
./.pinf_packages folder. You should get NYI errors from the adapter
until it runs through.
Once that HelloWorld program works you can run a bunch of different
tests from ./demos/ in the
github.com/pinf/loader-js repo. See
"Portable" at
https://github.com/pinf/loader-js/blob/master/docs/Demos.md
To get commonjs --platform c8cgi working the sh script needs to be
fixed. See
https://github.com/pinf/loader-js/blob/master/pinf-loader.sh
I don't know bash well enough to wrestle with that. It should locate the
binary on the OS and use that instead of node.
The platform require is used by the loader to load platform-native
modules. This allows you to map platform-native modules to a
require-prefix in a package (CommonJS/Mappings/C).
The global require is something that GPSEE has but is not necessarily
required. I think the only difference is the context. Rather than having
the context of the module it is called from it has a global context
without an attachment to a file/module (Wes can confirm). I am using it
because I load modules on behalf of other modules using the
platformRequire function so the calling context does not matter anyway
(or rather I don't have a means to pass it on to the global require -
this may help with debugging and stack traces if working though, not
sure yet).
If you get the adapter completed, v8cgi will be the second (after node)
to have support for asynchronously downloading package dependencies
meaning you can boot entire JavaScript programs from a URL.
We can then try and get the
CanvasGraphics
demo working on v8cgi by wiring up a JSGI interface for node and
v8cgi which I have working for jetpack already (and get rid of node
connect which the demo is currently using). This is very interesting
because you could then run the PINF Program Server in the v8cgi apache
module and dynamically serve programs from disk resolving all
dependencies as needed without the need to run a development server
outside of apache. This would be a great way for newcomers to play with
CommonJS packages, dependencies and modules without needing to
understand a lot of pieces.
Very exiting!
Christoph