[sr-dev] [kamailio/kamailio] add duk_module_node to module app_jsdt (PR #3038)
notifications at github.com
Tue Mar 1 02:02:25 CET 2022
> * one can load another JS file in the Kamailio KEMI JS file, but this another JS file has its content following the node.js module specs, right? It cannot be just any JS code
I think the require() must be a node.js, but not sure from my reading of https://github.com/svaarala/duktape/tree/master/extras/module-node. My local testing looks like this:
var test_include = require('./test');
module.exports = function test_include()
KSR.info('LOG FROM INCLUDED test FUNCTION--------');
My testing includes do not work as expected without module.exports.
> * does it allow loading any node.js modules available out there that do not require the node.js core modules (which are embedded (compiled) in node.js binary)?
I tried testing using a simple NPM module with a relative include and kamailio would not start with error
` jsdt_kemi_load_script(): failed running: SyntaxError: expected identifier`
I think this indicates as currently implemented not just any node.js module can be used. This PR does not try to resolve package names and only tries to resolve relative and absolute files.
Reply to this email directly or view it on GitHub:
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3038/c1054866552 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the sr-dev