Add support for node v20. (#1063)
This commit is contained in:
+3
-1
@@ -82,7 +82,9 @@ function shimFs(binary: NexeHeader, fs: typeof import('fs') = require('fs')) {
|
||||
if (returningArray == null) returningArray = Array.isArray(original.call(this, ''))
|
||||
const res = internalModuleReadFile.call(this, original, ...args)
|
||||
return returningArray && !Array.isArray(res)
|
||||
? [res, /"(main|name|type|exports|imports)"/.test(res)]
|
||||
? res === ''
|
||||
? []
|
||||
: [res, /"(main|name|type|exports|imports)"/.test(res)]
|
||||
: res
|
||||
}
|
||||
patches.internalModuleStat = function (this: any, original: any, ...args: any[]) {
|
||||
|
||||
@@ -55,13 +55,22 @@ export default async function main(compiler: NexeCompiler, next: () => Promise<v
|
||||
})
|
||||
|
||||
const fileLines = file.contents.toString().split('\n')
|
||||
fileLines.splice(
|
||||
location.start.line,
|
||||
0,
|
||||
'{{ file("lib/fs/bootstrap.js") }}' +
|
||||
'\n' +
|
||||
(semverGt(version, '11.99') ? 'expandArgv1 = false;\n' : '')
|
||||
)
|
||||
if (semverGt(version, '19.99')) {
|
||||
await compiler.replaceInFileAsync(
|
||||
'lib/internal/modules/cjs/loader.js',
|
||||
"'use strict';",
|
||||
"'use strict';\n" + '{{ file("lib/fs/bootstrap.js") }}' + '\n'
|
||||
)
|
||||
fileLines.splice(location.start.line, 0, 'expandArgv1 = false;')
|
||||
} else {
|
||||
fileLines.splice(
|
||||
location.start.line,
|
||||
0,
|
||||
'{{ file("lib/fs/bootstrap.js") }}' +
|
||||
'\n' +
|
||||
(semverGt(version, '11.99') ? 'expandArgv1 = false;\n' : '')
|
||||
)
|
||||
}
|
||||
file.contents = fileLines.join('\n')
|
||||
|
||||
if (semverGt(version, '11.99')) {
|
||||
|
||||
Reference in New Issue
Block a user