Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 563aa97a89 |
Generated
+2822
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "nexe",
|
||||
"description": "Create a single executable out of your Node.js application",
|
||||
"license": "MIT",
|
||||
"version": "2.0.0-beta.3",
|
||||
"version": "2.0.0-beta.4",
|
||||
"contributors": [
|
||||
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
|
||||
"Jared Allard <jaredallard@outlook.com>",
|
||||
|
||||
@@ -9,6 +9,7 @@ function hashName(name: string | Buffer) {
|
||||
|
||||
export interface FuseBoxFile {
|
||||
info: { absPath: string }
|
||||
absPath: string
|
||||
contents: string
|
||||
analysis: {
|
||||
dependencies: string[]
|
||||
@@ -55,12 +56,12 @@ export class NativeModulePlugin {
|
||||
transform(file: FuseBoxFile) {
|
||||
file.loadContents()
|
||||
|
||||
if (file.info.absPath.endsWith('.node')) {
|
||||
const contents = readFileSync(file.info.absPath)
|
||||
if (file.absPath.endsWith('.node')) {
|
||||
const contents = readFileSync(file.absPath)
|
||||
const module = this.modules.find(x =>
|
||||
Boolean(~file.info.absPath.indexOf(join('node_modules', x)))
|
||||
Boolean(~file.absPath.indexOf(join('node_modules', x)))
|
||||
)!
|
||||
const bindingName = basename(file.info.absPath)
|
||||
const bindingName = basename(file.absPath)
|
||||
const settings = this.options[module]
|
||||
const moduleDir = hashName(contents)
|
||||
file.contents = `
|
||||
@@ -97,7 +98,7 @@ export class NativeModulePlugin {
|
||||
mkdirp(path.dirname(bindingFile));
|
||||
fs.writeFileSync(bindingFile, Buffer.from(binding, 'base64'));
|
||||
${settings.additionalFiles.reduce((code, filename, i) => {
|
||||
const contents = readFileSync(join(dirname(file.info.absPath), filename))
|
||||
const contents = readFileSync(join(dirname(file.absPath), filename))
|
||||
return (code += `
|
||||
var file${i} = '${contents.toString('base64')}';
|
||||
var filePath${i} = path.join(cwd, bindingFileParts[0], '${filename
|
||||
@@ -117,7 +118,7 @@ export class NativeModulePlugin {
|
||||
plugins: [
|
||||
{
|
||||
onNode(file, node, parent) {
|
||||
bindingsRewrite.onNode(file.info.absPath, node, parent)
|
||||
bindingsRewrite.onNode(file.absPath, node, parent)
|
||||
},
|
||||
onEnd(file) {
|
||||
if (bindingsRewrite.rewrite) {
|
||||
|
||||
+2
-1
@@ -229,7 +229,8 @@ export class NexeCompiler {
|
||||
await next()
|
||||
const header = compiler._generateHeader()
|
||||
const contents = inflate(this._getPayload(header), +header.paddingSize) + tail
|
||||
return compiler.setFileContentsAsync(`lib/${compiler.options.name}.js`, contents)
|
||||
const file = await compiler.readFileAsync('lib/_third_party_main.js')
|
||||
file.contents += '\n' + contents
|
||||
}
|
||||
|
||||
async compileAsync() {
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ function extractName(options: NexeOptions) {
|
||||
|
||||
function normalizeOptionsAsync(input: Partial<NexeOptions>) {
|
||||
if (argv.help || argv._.some((x: string) => x === 'version')) {
|
||||
process.stderr.write(argv.help ? help : '2.0.0-beta.3' + EOL, () => process.exit(0))
|
||||
process.stderr.write(argv.help ? help : '2.0.0-beta.4' + EOL, () => process.exit(0))
|
||||
}
|
||||
|
||||
const options = Object.assign({}, defaults, input) as NexeOptions
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NexeCompiler } from '../compiler'
|
||||
|
||||
export default async function buildFixes(compiler: NexeCompiler, next: () => Promise<void>) {
|
||||
if (!compiler.options.version.startsWith('8.2')) {
|
||||
return next()
|
||||
}
|
||||
|
||||
const file = await compiler.readFileAsync('./tools/msvs/find_python.cmd')
|
||||
|
||||
await compiler.replaceInFileAsync(
|
||||
'./tools/msvs/find_python.cmd',
|
||||
'%p%python.exe -V 2>&1',
|
||||
'"%p%python.exe" -V 2>&1'
|
||||
)
|
||||
|
||||
return next()
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import gyp from './gyp'
|
||||
import nexePatches from './third-party-main'
|
||||
import buildFixes from './build-fixes'
|
||||
import cli from './disable-node-cli'
|
||||
import flags from './flags'
|
||||
import ico from './ico'
|
||||
@@ -10,6 +11,7 @@ const patches = [
|
||||
gyp,
|
||||
(compiler: NexeCompiler, next: () => Promise<void>) => compiler.setMainModule(compiler, next),
|
||||
nexePatches,
|
||||
buildFixes,
|
||||
cli,
|
||||
flags,
|
||||
ico,
|
||||
|
||||
@@ -74,10 +74,7 @@ fs.readFileSync = function readFileSync (file, options) {
|
||||
fs.closeSync(fd)
|
||||
const contents = Buffer.from(result.toString(), 'base64')
|
||||
return encoding ? contents.toString(encoding) : contents
|
||||
}
|
||||
|
||||
require("${compiler.options.name}");
|
||||
`.trim()
|
||||
}`.trim()
|
||||
)
|
||||
return next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user