fix(node22): handle new arg order (#1120)

This commit is contained in:
Caleb Boyd
2025-03-08 10:01:02 -06:00
committed by GitHub
parent 5219a2ac74
commit 3ca0d81922
2 changed files with 11 additions and 6 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "nexe",
"description": "Create a single executable out of your Node.js application",
"license": "MIT",
"version": "5.0.0-beta.3",
"version": "5.0.0-beta.4",
"contributors": [
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
"Jared Allard <jaredallard@outlook.com>",
+10 -5
View File
@@ -88,14 +88,19 @@ function shimFs(binary: NexeHeader, fs: typeof import('fs') = require('fs')) {
: res
}
patches.internalModuleStat = function (this: any, original: any, ...args: any[]) {
log(`internalModuleStat ${args[0]}`)
let statPath = args[0]
//in node 22, the path arg moved to arg[1]
if (typeof args[0] !== 'string') statPath = args[1]
let result = 0
try {
const stat = posixSnapshotZipFs.statSync(args[0])
if (stat.isDirectory()) return 1
return 0
const stat = posixSnapshotZipFs.statSync(statPath)
if (stat.isDirectory()) result = 1
else result = 0
} catch (e) {
return -constants.ENOENT
result = -constants.ENOENT
}
log(`internalModuleStat ${result} ${statPath}`)
return result
}
lazyRestoreFs = () => {