From 175124c0c96bdf2a1c323bc464a17ba1597a8a5f Mon Sep 17 00:00:00 2001 From: animetosho Date: Tue, 23 Jan 2024 20:49:51 +1000 Subject: [PATCH] Try fix nexe build again --- nexe/build.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nexe/build.js b/nexe/build.js index 7d2aedf..9d9148b 100644 --- a/nexe/build.js +++ b/nexe/build.js @@ -184,12 +184,17 @@ nexe.compile({ var data = await compiler.readFileAsync('deps/yencode/src/yencode.cc'); data = data.contents.toString(); data = data.replace(/#if NODE_VERSION_AT_LEAST\(10, 7, 0\).+?NODE_MODULE_INIT.+?#endif/s, -`#include "../../../src/node_internals.h" +`#define NODE_WANT_INTERNALS 1 +#include "../../../src/node_internals.h" #include static uv_once_t init_once = UV_ONCE_INIT; void yencode_init(Local exports, Local module, Local context, void* priv)` ); - data = data.replace(/(\nNODE_BUILTIN_MODULE_CONTEXT_AWARE\(yencode, yencode_init\))?$/, "\nNODE_BUILTIN_MODULE_CONTEXT_AWARE(yencode, yencode_init)"); + if(parseFloat(nodeVer) >= 12) { + data = data.replace(/(\nNODE_MODULE_CONTEXT_AWARE_INTERNAL\(yencode, yencode_init\))?$/, "\nNODE_MODULE_CONTEXT_AWARE_INTERNAL(yencode, yencode_init)"); + } else { + data = data.replace(/(\nNODE_BUILTIN_MODULE_CONTEXT_AWARE\(yencode, yencode_init\))?$/, "\nNODE_BUILTIN_MODULE_CONTEXT_AWARE(yencode, yencode_init)"); + } await compiler.setFileContentsAsync('deps/yencode/src/yencode.cc', data); data = await compiler.readFileAsync('deps/yencode/index.js');