From 76f9b133e83ac7b4a2264a64f2e54d1d85f42025 Mon Sep 17 00:00:00 2001 From: Gregor MacLennan Date: Wed, 18 Dec 2024 22:15:15 +0000 Subject: [PATCH] chore: update backend native deps This updates the holepunch.to managed native deps to the latest versions, using the updated prebuilds. --- scripts/build-backend.mjs | 4 +- scripts/download-prebuilds.mjs | 48 +++++----- src/backend/package-lock.json | 165 +++++++++++---------------------- 3 files changed, 82 insertions(+), 135 deletions(-) diff --git a/scripts/build-backend.mjs b/scripts/build-backend.mjs index 8cac44c64..d94f0d62a 100755 --- a/scripts/build-backend.mjs +++ b/scripts/build-backend.mjs @@ -33,10 +33,10 @@ await Promise.all([ fs.cpSync('./src/backend', './nodejs-assets/backend', {recursive: true}); fs.mkdirSync('./nodejs-assets/nodejs-project/node_modules', {recursive: true}); -fs.writeFileSync('./nodejs-assets/BUILD_NATIVE_MODULES.txt', '1', { +fs.writeFileSync('./nodejs-assets/BUILD_NATIVE_MODULES.txt', '0', { encoding: 'utf-8', }); -console.log('Set build native modules on'); +console.log('Set build native modules off'); console.groupEnd(); diff --git a/scripts/download-prebuilds.mjs b/scripts/download-prebuilds.mjs index 8e409ac76..a213fc932 100755 --- a/scripts/download-prebuilds.mjs +++ b/scripts/download-prebuilds.mjs @@ -3,48 +3,56 @@ import {$} from 'execa'; import fs from 'node:fs'; import path from 'node:path'; +import {createRequire} from 'node:module'; +import {fileURLToPath} from 'node:url'; + +const require = createRequire(import.meta.url); // NOTE: we currently don't support building for intel arch (android-x64) -const TARGETS = ['android-arm', 'android-arm64']; +const TARGETS = ['android-arm', 'android-arm64', 'android-x64']; // TODO: Figure out how to know if module uses N-API at runtime const NATIVE_MODULES = [ - {name: 'better-sqlite3', version: '8.7.0', usesNapi: false}, - {name: 'crc-native', version: '1.0.11', usesNapi: true}, - {name: 'fs-native-extensions', version: '1.2.3', usesNapi: true}, - {name: 'quickbit-native', version: '2.2.0', usesNapi: true}, - {name: 'simdle-native', version: '1.2.0', usesNapi: true}, - {name: 'sodium-native', version: '4.0.4', usesNapi: true}, - {name: 'udx-native', version: '1.7.12', usesNapi: true}, + {name: 'better-sqlite3', usesNapi: false}, + {name: 'crc-native', usesNapi: true}, + {name: 'fs-native-extensions', usesNapi: true}, + {name: 'quickbit-native', usesNapi: true}, + {name: 'simdle-native', usesNapi: true}, + {name: 'sodium-native', usesNapi: true}, ]; // Uncomment line below if you want to run this script directly -// await downloadPrebuilds(); +// await downloadPrebuilds({verbose: true}); /** * @param {{verbose?: boolean}} opts */ export async function downloadPrebuilds({verbose} = {verbose: false}) { - const prevCwd = process.cwd(); - - process.chdir( - path.resolve( - new URL('../nodejs-assets/nodejs-project/node_modules', import.meta.url) - .pathname, - ), + const backendRootUrl = new URL('../src/backend/', import.meta.url); + const nodejsProjectUrl = new URL( + '../nodejs-assets/nodejs-project/', + import.meta.url, ); const {abi: NODE_ABI} = getNodeJsMobileNodeVersions(); return Promise.all( - NATIVE_MODULES.map(async ({name, version, usesNapi}) => { + NATIVE_MODULES.map(async ({name, usesNapi}) => { + const pkgJsonPath = require.resolve(`${name}/package.json`, { + paths: [fileURLToPath(backendRootUrl)], + }); + const {version} = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8')); if (verbose) { console.log(`${name}: prebuilds start (${version})`); } + const prebuildsDir = fileURLToPath( + new URL(`node_modules/${name}/prebuilds/`, nodejsProjectUrl), + ); + fs.rmSync(prebuildsDir, {recursive: true, force: true}); await Promise.all( TARGETS.map(async target => { - const targetDir = path.join(name, 'prebuilds', target); + const targetDir = path.join(prebuildsDir, target); fs.mkdirSync(targetDir, {recursive: true}); @@ -85,9 +93,7 @@ export async function downloadPrebuilds({verbose} = {verbose: false}) { console.log(`${name}: prebuilds done (${version})`); } }), - ).finally(() => { - process.chdir(prevCwd); - }); + ); } function getNodeJsMobileNodeVersions() { diff --git a/src/backend/package-lock.json b/src/backend/package-lock.json index 7a4d4631c..28cd478eb 100644 --- a/src/backend/package-lock.json +++ b/src/backend/package-lock.json @@ -1744,16 +1744,6 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, - "node_modules/bare-addon-resolve": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/bare-addon-resolve/-/bare-addon-resolve-1.4.2.tgz", - "integrity": "sha512-tvUF2orgRAfazmCwZuOUtj5sudU1iowTtwlD63BGvxh50KrHugBMQAUaSk4KxjfEznT99PuJyJSpc4ObPTiS6g==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "bare-module-resolve": "^1.5.0" - } - }, "node_modules/bare-events": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.4.2.tgz", @@ -1772,16 +1762,6 @@ "bare-stream": "^2.0.0" } }, - "node_modules/bare-module-resolve": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/bare-module-resolve/-/bare-module-resolve-1.6.1.tgz", - "integrity": "sha512-IM+aQ7c0HXpKbKTFLakMohyxfOxl+lj9w3mWkHAMMCmAf1SO8rNOX+chyERkefi5BN/Fr3l177CfS4c0wK6AxA==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "semver": "^7.6.0" - } - }, "node_modules/bare-os": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.4.4.tgz", @@ -2301,13 +2281,13 @@ } }, "node_modules/crc-native": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/crc-native/-/crc-native-1.1.1.tgz", - "integrity": "sha512-Qr1DdDkcMY5Q3vi7lYGDaYdtOpPyFY3h/7cSLMhc95jhI6Gnf3bV/stJ3MKfSJqe8cWnUuJ+vUrbNKw5HA+LEw==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/crc-native/-/crc-native-1.1.5.tgz", + "integrity": "sha512-toSzpisZ2AhmmfTA6h2Lt0JWOM6G+y0wAGP+JL9bkmLvwpWV2Co4P+DhGEOcGabIeFORZmfIvEs7VAm7kma5vg==", "license": "Apache-2.0", "optional": true, "dependencies": { - "load-addon": "^1.0.0" + "node-gyp-build": "^4.8.2" } }, "node_modules/crc-universal": { @@ -3410,15 +3390,14 @@ } }, "node_modules/fs-native-extensions": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-native-extensions/-/fs-native-extensions-1.2.7.tgz", - "integrity": "sha512-IIWKE5oNTMNwp03daCbRgnCaiEdd0r/BPHwD3Ns4NlHH28FQgfwg0ntg8AgaPO236wN0szt2t1NM+VmCW2TcxQ==", - "hasInstallScript": true, + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fs-native-extensions/-/fs-native-extensions-1.3.2.tgz", + "integrity": "sha512-fQaLJt4uY96iiMdy+rV561TaXefkfTq4dmSXcN2D1z8SBtFTsmcO3GaJexPKTxltqdh826JQBK1CySo3EpzgQQ==", "license": "Apache-2.0", "optional": true, "dependencies": { - "napi-macros": "^2.0.0", - "node-gyp-build": "^4.2.3" + "node-gyp-build": "^4.8.2", + "which-runtime": "^1.2.0" } }, "node_modules/fs.realpath": { @@ -4315,16 +4294,6 @@ "set-cookie-parser": "^2.4.1" } }, - "node_modules/load-addon": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/load-addon/-/load-addon-1.0.0.tgz", - "integrity": "sha512-6XaA7xfpHW1CeQRrLFE9+9y8nDZMX3ZaoCMSo+Gp2i58dfY549SQqqb2ukAgQtAACEDJmaroHJvnL03cJ+KLvA==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "bare-addon-resolve": "^1.3.0" - } - }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -4563,13 +4532,6 @@ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", "license": "MIT" }, - "node_modules/napi-macros": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz", - "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==", - "license": "MIT", - "optional": true - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -5282,14 +5244,14 @@ "license": "MIT" }, "node_modules/quickbit-native": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/quickbit-native/-/quickbit-native-2.3.1.tgz", - "integrity": "sha512-/WOLyxcG6jFjuCuiND9/gXRlR4Po20UGhuc9izpVLioiJ2hWhoIgrNaTCkwgnPhrr1Rz8DGNCntJNEyspfo0Ug==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/quickbit-native/-/quickbit-native-2.3.4.tgz", + "integrity": "sha512-inl+SbEDqL+NTGFsk/S7nhaFtNEUANpXM1umGeJdOY0gtCLcDTSOZ9sGIXcaKukBgThw9cTD1rgCsYy6sAox+A==", "license": "Apache-2.0", "optional": true, "dependencies": { "b4a": "^1.6.0", - "load-addon": "^1.0.0" + "node-gyp-build": "^4.8.2" } }, "node_modules/quickbit-universal": { @@ -5801,14 +5763,14 @@ } }, "node_modules/simdle-native": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/simdle-native/-/simdle-native-1.3.1.tgz", - "integrity": "sha512-QEFxH5JPLzMJy8pzv6Y/RA9K7F0MDOXcB+as6V+XlNOPI5Lpt0LjR6cl3muvBHk6oZiiHj5O8TOkP8ToN9kbsQ==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/simdle-native/-/simdle-native-1.3.4.tgz", + "integrity": "sha512-7fWq9N5wP3ZYdiBcdjdNFHQ+kU/+rxr785HbxMmFjEb8choPbgE9p4fJ5Nm/H2rpSyVkgY9j0E9hYY1RAvBg+A==", "license": "Apache-2.0", "optional": true, "dependencies": { "b4a": "^1.6.0", - "load-addon": "^1.0.0" + "node-gyp-build": "^4.8.2" } }, "node_modules/simdle-universal": { @@ -5890,10 +5852,9 @@ } }, "node_modules/sodium-native": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.2.0.tgz", - "integrity": "sha512-rdJRAf/RE/IRFUUoUsz10slNAQDTGz5ChpIeR1Ti0BtGYstl6Uok4hHALPBdnFcLml6qXJ2pDd0/De09mPa6mg==", - "hasInstallScript": true, + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.3.1.tgz", + "integrity": "sha512-YdP64gAdpIKHfL4ttuX4aIfjeunh9f+hNeQJpE9C8UMndB3zkgZ7YmmGT4J2+v6Ibyp6Wem8D1TcSrtdW0bqtg==", "license": "MIT", "dependencies": { "node-gyp-build": "^4.8.0" @@ -6619,6 +6580,13 @@ "node": ">= 8" } }, + "node_modules/which-runtime": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-runtime/-/which-runtime-1.2.1.tgz", + "integrity": "sha512-8feIHccQFH/whiA1fD1b4c5+Q7T4ry1g1oHYc2mHnFh81tTQFsCvy3zhS2geUapkFAVBddUT/AM1a3rbqJweFg==", + "license": "Apache-2.0", + "optional": true + }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", @@ -8056,15 +8024,6 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, - "bare-addon-resolve": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/bare-addon-resolve/-/bare-addon-resolve-1.4.2.tgz", - "integrity": "sha512-tvUF2orgRAfazmCwZuOUtj5sudU1iowTtwlD63BGvxh50KrHugBMQAUaSk4KxjfEznT99PuJyJSpc4ObPTiS6g==", - "optional": true, - "requires": { - "bare-module-resolve": "^1.5.0" - } - }, "bare-events": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.4.2.tgz", @@ -8081,15 +8040,6 @@ "bare-stream": "^2.0.0" } }, - "bare-module-resolve": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/bare-module-resolve/-/bare-module-resolve-1.6.1.tgz", - "integrity": "sha512-IM+aQ7c0HXpKbKTFLakMohyxfOxl+lj9w3mWkHAMMCmAf1SO8rNOX+chyERkefi5BN/Fr3l177CfS4c0wK6AxA==", - "optional": true, - "requires": { - "semver": "^7.6.0" - } - }, "bare-os": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.4.4.tgz", @@ -8445,12 +8395,12 @@ "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==" }, "crc-native": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/crc-native/-/crc-native-1.1.1.tgz", - "integrity": "sha512-Qr1DdDkcMY5Q3vi7lYGDaYdtOpPyFY3h/7cSLMhc95jhI6Gnf3bV/stJ3MKfSJqe8cWnUuJ+vUrbNKw5HA+LEw==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/crc-native/-/crc-native-1.1.5.tgz", + "integrity": "sha512-toSzpisZ2AhmmfTA6h2Lt0JWOM6G+y0wAGP+JL9bkmLvwpWV2Co4P+DhGEOcGabIeFORZmfIvEs7VAm7kma5vg==", "optional": true, "requires": { - "load-addon": "^1.0.0" + "node-gyp-build": "^4.8.2" } }, "crc-universal": { @@ -9170,13 +9120,13 @@ } }, "fs-native-extensions": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-native-extensions/-/fs-native-extensions-1.2.7.tgz", - "integrity": "sha512-IIWKE5oNTMNwp03daCbRgnCaiEdd0r/BPHwD3Ns4NlHH28FQgfwg0ntg8AgaPO236wN0szt2t1NM+VmCW2TcxQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fs-native-extensions/-/fs-native-extensions-1.3.2.tgz", + "integrity": "sha512-fQaLJt4uY96iiMdy+rV561TaXefkfTq4dmSXcN2D1z8SBtFTsmcO3GaJexPKTxltqdh826JQBK1CySo3EpzgQQ==", "optional": true, "requires": { - "napi-macros": "^2.0.0", - "node-gyp-build": "^4.2.3" + "node-gyp-build": "^4.8.2", + "which-runtime": "^1.2.0" } }, "fs.realpath": { @@ -9812,15 +9762,6 @@ "set-cookie-parser": "^2.4.1" } }, - "load-addon": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/load-addon/-/load-addon-1.0.0.tgz", - "integrity": "sha512-6XaA7xfpHW1CeQRrLFE9+9y8nDZMX3ZaoCMSo+Gp2i58dfY549SQqqb2ukAgQtAACEDJmaroHJvnL03cJ+KLvA==", - "optional": true, - "requires": { - "bare-addon-resolve": "^1.3.0" - } - }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -9988,12 +9929,6 @@ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" }, - "napi-macros": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz", - "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==", - "optional": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -10475,13 +10410,13 @@ "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==" }, "quickbit-native": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/quickbit-native/-/quickbit-native-2.3.1.tgz", - "integrity": "sha512-/WOLyxcG6jFjuCuiND9/gXRlR4Po20UGhuc9izpVLioiJ2hWhoIgrNaTCkwgnPhrr1Rz8DGNCntJNEyspfo0Ug==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/quickbit-native/-/quickbit-native-2.3.4.tgz", + "integrity": "sha512-inl+SbEDqL+NTGFsk/S7nhaFtNEUANpXM1umGeJdOY0gtCLcDTSOZ9sGIXcaKukBgThw9cTD1rgCsYy6sAox+A==", "optional": true, "requires": { "b4a": "^1.6.0", - "load-addon": "^1.0.0" + "node-gyp-build": "^4.8.2" } }, "quickbit-universal": { @@ -10838,13 +10773,13 @@ } }, "simdle-native": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/simdle-native/-/simdle-native-1.3.1.tgz", - "integrity": "sha512-QEFxH5JPLzMJy8pzv6Y/RA9K7F0MDOXcB+as6V+XlNOPI5Lpt0LjR6cl3muvBHk6oZiiHj5O8TOkP8ToN9kbsQ==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/simdle-native/-/simdle-native-1.3.4.tgz", + "integrity": "sha512-7fWq9N5wP3ZYdiBcdjdNFHQ+kU/+rxr785HbxMmFjEb8choPbgE9p4fJ5Nm/H2rpSyVkgY9j0E9hYY1RAvBg+A==", "optional": true, "requires": { "b4a": "^1.6.0", - "load-addon": "^1.0.0" + "node-gyp-build": "^4.8.2" } }, "simdle-universal": { @@ -10883,9 +10818,9 @@ "dev": true }, "sodium-native": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.2.0.tgz", - "integrity": "sha512-rdJRAf/RE/IRFUUoUsz10slNAQDTGz5ChpIeR1Ti0BtGYstl6Uok4hHALPBdnFcLml6qXJ2pDd0/De09mPa6mg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.3.1.tgz", + "integrity": "sha512-YdP64gAdpIKHfL4ttuX4aIfjeunh9f+hNeQJpE9C8UMndB3zkgZ7YmmGT4J2+v6Ibyp6Wem8D1TcSrtdW0bqtg==", "requires": { "node-gyp-build": "^4.8.0" } @@ -11392,6 +11327,12 @@ "isexe": "^2.0.0" } }, + "which-runtime": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-runtime/-/which-runtime-1.2.1.tgz", + "integrity": "sha512-8feIHccQFH/whiA1fD1b4c5+Q7T4ry1g1oHYc2mHnFh81tTQFsCvy3zhS2geUapkFAVBddUT/AM1a3rbqJweFg==", + "optional": true + }, "wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",