From 8a7655b5f6bc463c42fb2d824647d76f696a4f8b Mon Sep 17 00:00:00 2001 From: Cheng Date: Tue, 7 Jan 2025 09:44:21 +0900 Subject: [PATCH] Update to Node 22.12.0 --- build.mjs | 8 +++-- common.gypi | 78 ---------------------------------------- node | 2 +- src/asar_monkey_patch.js | 31 +++++++--------- src/bootstrap.js | 2 +- yode.gyp | 1 + 6 files changed, 20 insertions(+), 102 deletions(-) diff --git a/build.mjs b/build.mjs index 6b71e6a..4b7e29a 100755 --- a/build.mjs +++ b/build.mjs @@ -96,11 +96,13 @@ if (process.platform == 'darwin') { // Copy fields from config.gypi of node. const configGypiPath = fs.readFileSync(path.join(__dirname, 'node', 'config.gypi')).toString() const configGypi = JSON.parse(configGypiPath.split('\n').slice(1).join('\n').replace(/'/g, '"')) -for (const key of ['clang', 'node_builtin_shareable_builtins']) { - config.variables[key] = configGypi.variables[key] +for (const key in configGypi.variables) { + if (!(key in config.variables)) + config.variables[key] = configGypi.variables[key] } -// Read node_library_files from config.gypi. +// Map node_library_files from config.gypi. config.variables.node_library_files = configGypi.variables.node_library_files.map(l => 'node/' + l) +// Write our own config.gypi file. fs.writeFileSync(`${__dirname}/config.gypi`, JSON.stringify(config, null, ' ')) await $`${python} node/tools/gyp/gyp_main.py yode.gyp --no-parallel -f ninja -Dbuild_type=${buildType} -Iconfig.gypi -Icommon.gypi --depth .` diff --git a/common.gypi b/common.gypi index d263a9b..c455f00 100644 --- a/common.gypi +++ b/common.gypi @@ -3,86 +3,8 @@ 'node/common.gypi', ], 'variables': { - # Reflects node's config.gypi. - 'library%': 'static_library', 'component': 'static_library', - 'coverage': 'false', - 'llvm_version': '3.3', - 'debug_nghttp2': 'false', - 'debug_node': 'false', - 'enable_lto': 'false', - 'enable_pgo_generate': 'false', - 'enable_pgo_use': 'false', - 'force_dynamic_crt': 0, - 'openssl_fips': '', - 'openssl_is_fips': 'false', - 'openssl_no_asm': 1, - 'openssl_quic': 'true', - 'OPENSSL_PRODUCT': 'libopenssl.a', - 'node_release_urlbase': '', - 'node_byteorder': ' 0] + if (!info || info.size === 0) + return undefined + const realPath = process.asarArchive.copyFileOut(info) + return readPackageJSON(realPath, isESM, base, specifier) } - const {internalModuleStat} = process.binding('fs') - process.binding('fs').internalModuleStat = function(p) { + const internalFsBinding = internalBinding('fs') + const {internalModuleStat} = internalFsBinding + internalFsBinding.internalModuleStat = function(b, p) { const [isAsar, filePath] = splitPath(p) if (!isAsar) - return internalModuleStat(p) + return internalModuleStat(b, p) const stats = process.asarArchive.stat(filePath) if (!stats) return -34 // -ENOENT diff --git a/src/bootstrap.js b/src/bootstrap.js index 2ed9b4b..0ea41fc 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -40,7 +40,7 @@ function wrapWithActivateUvLoop(func) { if (this.loaded || this.loading) return this.exports const filename = this.id + '.js' - const {function: compiledWrapper} = compileFunctionForCJSLoader(this.source, filename) + const {function: compiledWrapper} = compileFunctionForCJSLoader(this.source, filename, false, false) compiledWrapper.call(this.exports, this.exports, require, this, filename, dirname); return this.exports } diff --git a/yode.gyp b/yode.gyp index aed11de..7b5be72 100644 --- a/yode.gyp +++ b/yode.gyp @@ -25,6 +25,7 @@ '.', 'node/deps/cares/include', # for ares.h 'node/deps/openssl/openssl/include', # for openssl/opensslv.h + 'node/deps/simdjson', # for simdjson.h 'node/deps/uv/include', # for uv.h 'node/src', # for node things ],