From d862f581db968519fb7adb38c8872d020f4f21e6 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Tue, 6 Dec 2022 14:30:13 +0000 Subject: [PATCH] Node.js: added "shortCircuit" option for ES modules hook. Starting from Node.js v18.6.0 return value from all hooks must have "shortCircuit: true" option specified. For more information see: https://github.com/nodejs/node/commit/10bcad5c6e --- docs/changes.xml | 6 ++++++ src/nodejs/unit-http/loader.mjs | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/changes.xml b/docs/changes.xml index 2dd1b472..9aaec9e5 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -67,6 +67,12 @@ compatibility with PHP 8.2. + + +compatibility with Node.js 19.0. + + + support rack v3 in ruby applications. diff --git a/src/nodejs/unit-http/loader.mjs b/src/nodejs/unit-http/loader.mjs index 546548f5..83985b0f 100644 --- a/src/nodejs/unit-http/loader.mjs +++ b/src/nodejs/unit-http/loader.mjs @@ -4,13 +4,15 @@ export async function resolve(specifier, context, defaultResolver) { case "websocket": return { url: new URL("./websocket.js", import.meta.url).href, - format: "commonjs" + format: "commonjs", + shortCircuit: true, } case "http": return { url: new URL("./http.js", import.meta.url).href, - format: "commonjs" + format: "commonjs", + shortCircuit: true, } }