]> git.kaiwu.me - njs.git/commit
Modules: introduced QuickJS engine.
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 15 Jun 2024 03:54:28 +0000 (20:54 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Wed, 18 Sep 2024 01:05:57 +0000 (18:05 -0700)
commit201b127679e27fe63eff5c1b4356ec4ed9ec4611
tree2477939f07f646ee6137a7d30ccc8e807206da61
parent9b6744129ce4c18e74b5e41cd1da66f2cbadcf36
Modules: introduced QuickJS engine.

"js_engine" directive is introduced which sets JavaScript engine.
When the module is built with QuickJS library "js_engine qjs;" sets
QuickJS engine for the current block. By default njs engine is used.

For example,

nginx.conf:

    location /a {
        js_engine qjs;
        # will be handled by QuickJS
        js_content main.handler;
    }

    location /b {
        # will be handled by njs
        js_content main.handler;
    }

QuickJS engine implements drop-in replacement for nginx/njs objects
with the following exceptions:

    * nginx module API to be added later: ngx.fetch(), ngx.shared.dict.
    * Built-in modules to be added later: fs, crypto, WebCrypto, xml.
    * NJS specific API: njs.dump(), njs.on(), console.dump().
    * js_preload_object directive.
30 files changed:
.github/workflows/check-pr.yml
nginx/config
nginx/config.make
nginx/ngx_http_js_module.c
nginx/ngx_js.c
nginx/ngx_js.h
nginx/ngx_stream_js_module.c
nginx/t/js_console.t
nginx/t/js_dump.t
nginx/t/js_engine.t [new file with mode: 0644]
nginx/t/js_fetch.t
nginx/t/js_fetch_https.t
nginx/t/js_fetch_objects.t
nginx/t/js_fetch_resolver.t
nginx/t/js_fetch_timeout.t
nginx/t/js_fetch_verify.t
nginx/t/js_object.t
nginx/t/js_periodic.t
nginx/t/js_preload_object.t
nginx/t/js_shared_dict.t
nginx/t/stream_js_console.t
nginx/t/stream_js_exit.t
nginx/t/stream_js_fetch.t
nginx/t/stream_js_fetch_https.t
nginx/t/stream_js_fetch_init.t
nginx/t/stream_js_object.t
nginx/t/stream_js_preload_object.t
nginx/t/stream_js_shared_dict.t
src/qjs.h
src/qjs_buffer.c