Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff612d610e |
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nexe",
|
"name": "nexe",
|
||||||
"version": "3.0.5",
|
"version": "3.1.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"name": "nexe",
|
"name": "nexe",
|
||||||
"description": "Create a single executable out of your Node.js application",
|
"description": "Create a single executable out of your Node.js application",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "3.0.5",
|
"version": "3.1.0",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
|
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
|
||||||
"Jared Allard <jaredallard@outlook.com>",
|
"Jared Allard <jaredallard@outlook.com>",
|
||||||
|
|||||||
+13
-13
@@ -13,24 +13,13 @@ export interface NexeBinary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let originalFsMethods: any = null
|
let originalFsMethods: any = null
|
||||||
let nexeBinary: NexeBinary | null = null
|
let lazyRestoreFs = () => {}
|
||||||
|
|
||||||
function restoreFs(fs: any = require('fs')): NexeBinary | false {
|
|
||||||
if (!nexeBinary) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
const source = nexeBinary
|
|
||||||
Object.assign(fs, originalFsMethods)
|
|
||||||
nexeBinary = originalFsMethods = null
|
|
||||||
return source
|
|
||||||
}
|
|
||||||
|
|
||||||
function shimFs(binary: NexeBinary, fs: any = require('fs')) {
|
function shimFs(binary: NexeBinary, fs: any = require('fs')) {
|
||||||
if (originalFsMethods !== null) {
|
if (originalFsMethods !== null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
originalFsMethods = Object.assign({}, fs)
|
originalFsMethods = Object.assign({}, fs)
|
||||||
nexeBinary = binary
|
|
||||||
const { blobPath, resources: manifest } = binary,
|
const { blobPath, resources: manifest } = binary,
|
||||||
{ resourceStart, stat } = binary.layout,
|
{ resourceStart, stat } = binary.layout,
|
||||||
directories: { [key: string]: { [key: string]: boolean } } = {},
|
directories: { [key: string]: { [key: string]: boolean } } = {},
|
||||||
@@ -41,7 +30,7 @@ function shimFs(binary: NexeBinary, fs: any = require('fs')) {
|
|||||||
path = require('path'),
|
path = require('path'),
|
||||||
baseDir = path.dirname(process.execPath)
|
baseDir = path.dirname(process.execPath)
|
||||||
|
|
||||||
let log = (text: string) => true
|
let log = (_: string) => true
|
||||||
if ((process.env.DEBUG || '').toLowerCase().includes('nexe:require')) {
|
if ((process.env.DEBUG || '').toLowerCase().includes('nexe:require')) {
|
||||||
log = (text: string) => process.stderr.write('[nexe] - ' + text + '\n')
|
log = (text: string) => process.stderr.write('[nexe] - ' + text + '\n')
|
||||||
}
|
}
|
||||||
@@ -330,7 +319,18 @@ function shimFs(binary: NexeBinary, fs: any = require('fs')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object.assign(fs, nfs)
|
Object.assign(fs, nfs)
|
||||||
|
|
||||||
|
lazyRestoreFs = () => {
|
||||||
|
Object.keys(nfs).forEach(key => {
|
||||||
|
fs[key] = originalFsMethods[key]
|
||||||
|
})
|
||||||
|
lazyRestoreFs = () => {}
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restoreFs() {
|
||||||
|
lazyRestoreFs()
|
||||||
|
}
|
||||||
|
|
||||||
export { shimFs, restoreFs }
|
export { shimFs, restoreFs }
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export interface NexeOptions {
|
|||||||
name: string
|
name: string
|
||||||
asset: string
|
asset: string
|
||||||
cwd: string
|
cwd: string
|
||||||
|
fs: boolean | string[]
|
||||||
flags: string[]
|
flags: string[]
|
||||||
configure: string[]
|
configure: string[]
|
||||||
vcBuild: string[]
|
vcBuild: string[]
|
||||||
@@ -59,6 +60,7 @@ export interface NexeOptions {
|
|||||||
const defaults = {
|
const defaults = {
|
||||||
flags: [],
|
flags: [],
|
||||||
cwd: process.cwd(),
|
cwd: process.cwd(),
|
||||||
|
fs: true,
|
||||||
configure: [],
|
configure: [],
|
||||||
mangle: true,
|
mangle: true,
|
||||||
make: [],
|
make: [],
|
||||||
|
|||||||
+3
-1
@@ -6,7 +6,9 @@ export default function(compiler: NexeCompiler, next: () => Promise<void>) {
|
|||||||
wrap(
|
wrap(
|
||||||
`process.__nexe = ${JSON.stringify(compiler.binaryConfiguration)};\n` +
|
`process.__nexe = ${JSON.stringify(compiler.binaryConfiguration)};\n` +
|
||||||
'{{replace:lib/fs/patch.js}}' +
|
'{{replace:lib/fs/patch.js}}' +
|
||||||
'\nshimFs(process.__nexe)'
|
'\nshimFs(process.__nexe)' +
|
||||||
|
`\n${compiler.options.fs ? '' : 'restoreFs()'}`
|
||||||
|
//TODO support only restoring specific methods
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
compiler.shims.push(
|
compiler.shims.push(
|
||||||
|
|||||||
Reference in New Issue
Block a user