Closed erichanson closed 5 years ago
One thought is to create an endpoint.v8_module
table with columns name text
, version text
, code text
, where code
is expected to be an IIFE.
The plv8-modules project is authored by the main plv8 guy and is a very simple approach. It has a tool for importing commonJS modules into the database. It defines a commonjs.plv8_modules
table, though doesn't track version number.
The es6-to-plv8 project exists.
The plv8x project exists.
The node-plv8 project exists.
Some good discussion of this going on in a plv8 issue. I think, long-term we'd like to use some form of es6 import
or import()
, which isn't implemented in plv8, but could potentially make sense. It's an interesting issue.
Anyway, I experimented with plv8-modules a bit which implements a pretty cool plv8.require()
function, but for it to work, modules need to be in commonJS format, which ours are not, so I guess we're stuck with eval for now.
I added a endpoint.js_module
table, and put a few libraries in there. Closing this, will revisit when plv8 makes decisions around using import.
Need a pattern for loading Javascript modules into plv8.