diff --git a/auto/njs b/auto/njs index c54a27c70..e5314d317 100644 --- a/auto/njs +++ b/auto/njs @@ -25,8 +25,8 @@ nxt_feature_incs="$NXT_NJS_CFLAGS $NXT_NJS_AUX_CFLAGS" nxt_feature_libs="$NXT_NJS_LIBS $NXT_NJS_AUX_LIBS" nxt_feature_test="#include - #if NJS_VERSION_NUMBER < 0x000800 - # error NJS < 0.8.0 is not supported. + #if NJS_VERSION_NUMBER < 0x000803 + # error NJS < 0.8.3 is not supported. #endif int main(void) { @@ -44,7 +44,7 @@ nxt_feature_test="#include if [ $nxt_found = no ]; then $echo - $echo $0: error: no NJS library \>= 0.8.0 found. + $echo $0: error: no NJS library \>= 0.8.3 found. $echo exit 1; fi diff --git a/docs/changes.xml b/docs/changes.xml index 6428d65ef..846823088 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -34,6 +34,12 @@ NGINX Unit updated to 1.33.0. date="" time="" packager="Nginx Packaging <nginx-packaging@f5.com>"> + + +if building with NJS, version 0.8.3 or later is now required. + + + diff --git a/pkg/contrib/src/njs/SHA512SUMS b/pkg/contrib/src/njs/SHA512SUMS index 437664871..47dbee05d 100644 --- a/pkg/contrib/src/njs/SHA512SUMS +++ b/pkg/contrib/src/njs/SHA512SUMS @@ -1 +1 @@ -cc3110a0c6866dfc03d19c58745e5b75aa9792999db45bc55a752f7b04db8ae51322bfe0156b873109c8477c6c1a030c851c770697cf6791c6e89fb2fed0a2c5 njs-0.8.2.tar.gz +1cec9a322c40aa2b4ec6eb5bea78d7442880b0cff3a41ad171a3dc3157a6990baec6c8b9eda99ee02a9e51c0b933f13ef17431079a5ff409aaf84b912c7f4df7 njs-0.8.3.tar.gz diff --git a/pkg/contrib/src/njs/version b/pkg/contrib/src/njs/version index 004534192..8b8d5b915 100644 --- a/pkg/contrib/src/njs/version +++ b/pkg/contrib/src/njs/version @@ -1 +1 @@ -NJS_VERSION := 0.8.2 +NJS_VERSION := 0.8.3 diff --git a/src/nxt_js.c b/src/nxt_js.c index 6885afb77..1f9a3ceb1 100644 --- a/src/nxt_js.c +++ b/src/nxt_js.c @@ -69,14 +69,6 @@ nxt_js_module_loader(njs_vm_t *vm, njs_external_ptr_t external, njs_str_t *name) } -static njs_vm_ops_t nxt_js_ops = { - NULL, - NULL, - nxt_js_module_loader, - NULL, -}; - - njs_int_t nxt_js_proto_id; @@ -127,6 +119,7 @@ nxt_js_vm_create(nxt_js_conf_t *jcf) { u_char *p; size_t size; + njs_vm_t *vm; nxt_uint_t i; njs_vm_opt_t opts; nxt_js_module_t *module, *mod; @@ -146,7 +139,6 @@ nxt_js_vm_create(nxt_js_conf_t *jcf) goto done; } - opts.ops = &nxt_js_ops; opts.external = jcf; size = 0; @@ -203,7 +195,13 @@ nxt_js_vm_create(nxt_js_conf_t *jcf) done: - return njs_vm_create(&opts); + vm = njs_vm_create(&opts); + + if (nxt_fast_path(vm != NULL)) { + njs_vm_set_module_loader(vm, nxt_js_module_loader, jcf); + } + + return vm; } diff --git a/src/nxt_script.c b/src/nxt_script.c index 70045a229..05d9561da 100644 --- a/src/nxt_script.c +++ b/src/nxt_script.c @@ -37,14 +37,6 @@ static void nxt_script_buf_completion(nxt_task_t *task, void *obj, void *data); static nxt_lvlhsh_t nxt_script_info; -static njs_vm_ops_t nxt_js_ops = { - NULL, - NULL, - nxt_js_module_loader, - NULL, -}; - - nxt_script_t * nxt_script_new(nxt_task_t *task, nxt_str_t *name, u_char *data, size_t size, u_char *error) @@ -63,8 +55,6 @@ nxt_script_new(nxt_task_t *task, nxt_str_t *name, u_char *data, size_t size, opts.file.start = (u_char *) "default"; opts.file.length = 7; - opts.ops = &nxt_js_ops; - vm = njs_vm_create(&opts); if (nxt_slow_path(vm == NULL)) { return NULL;