fix(node22): handle new arg order (#1120)
This commit is contained in:
+1
-1
@@ -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
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user