Compare commits
210 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bbe26640df | |||
| 54675f0e23 | |||
| 3ac02efd18 | |||
| b100922d91 | |||
| 87660c3682 | |||
| 635cd62196 | |||
| 336a5ea2e3 | |||
| 7fe0d207de | |||
| 3e708ca916 | |||
| de84339c80 | |||
| fb81a9c75e | |||
| 0e34905ddc | |||
| c1e7416644 | |||
| 53daa903ea | |||
| 9e2a5f1c78 | |||
| 82a6e8f1c7 | |||
| 7641afa5a4 | |||
| 34210a3bd6 | |||
| 6ce224d6e4 | |||
| 53a9c5a210 | |||
| 727f081e87 | |||
| 907be00fdc | |||
| 14d1ec38d1 | |||
| de531ba750 | |||
| a497851a74 | |||
| 915181d0b0 | |||
| 002727e10f | |||
| a9aa1f81fa | |||
| 16139e1dc7 | |||
| 2bc181f2ab | |||
| 4c80d88013 | |||
| 36094e8d47 | |||
| af42599a15 | |||
| 78ca929350 | |||
| 024b9f8cb3 | |||
| 312a63a0b6 | |||
| 995e03eeea | |||
| b803ae7ddd | |||
| d2e954b5ab | |||
| ec421204d0 | |||
| 292063c482 | |||
| a0a82e9547 | |||
| e1b30b86ae | |||
| 4c88a01003 | |||
| 5dbd6b4048 | |||
| ce6c570c01 | |||
| 44581eb3d3 | |||
| d4be3712cd | |||
| 882c838cb5 | |||
| e6e49bbbd9 | |||
| 0ae40b9a3c | |||
| 879b1598bc | |||
| 5c40ca30af | |||
| afb143daf4 | |||
| 3dd5a2102f | |||
| 2cfd10261a | |||
| e7c7878675 | |||
| 3b42e4a5e8 | |||
| c9431fc206 | |||
| dd68923607 | |||
| 8901e4a2fa | |||
| 38a920be24 | |||
| ce7a36958f | |||
| b0644f0d62 | |||
| 4e402bf937 | |||
| 5a3bbbad3a | |||
| 1d14ca6359 | |||
| 1114a581ae | |||
| 7ab7f986cf | |||
| 1d09a6b001 | |||
| 636268504e | |||
| e8dead82bb | |||
| d2d703e9ea | |||
| 09f36c48e0 | |||
| 6e2870e5d0 | |||
| cd0e5a012c | |||
| 17fe557afa | |||
| e4a8d86237 | |||
| 7b3bcac07c | |||
| fb637e0da3 | |||
| 17c506c9cc | |||
| 7a25c2bfd9 | |||
| f784c79ca1 | |||
| bd75617a2a | |||
| b7ffb8266a | |||
| 08b7ad765d | |||
| 3a7eb91d3b | |||
| a0017ed3fe | |||
| d4205a70c3 | |||
| 380b0e9541 | |||
| 86fa69920c | |||
| 3144ae8d6f | |||
| 322f432756 | |||
| dcf44f7a80 | |||
| 7b68d7bfee | |||
| 1684c8fe5d | |||
| 2c132110b9 | |||
| cf97acfcdb | |||
| a1405a3b36 | |||
| 6c844fa5f7 | |||
| a40454a5ae | |||
| 94c5a54d5f | |||
| 99e228a145 | |||
| 564dffe925 | |||
| 7b9f235715 | |||
| e7b28d0aa5 | |||
| bc37c3ce7b | |||
| 87c5e1df7d | |||
| 05ecc6b8a5 | |||
| e89844fa78 | |||
| 0637e17eb0 | |||
| c8562c384d | |||
| c07e1d62c7 | |||
| ec60175d8f | |||
| 81192a7b3a | |||
| 029487c187 | |||
| 71eef791c6 | |||
| e1eaaa2bfc | |||
| 7ef54aa56f | |||
| c09bca3462 | |||
| 552158485c | |||
| 553d9a2fff | |||
| fcd2acfed6 | |||
| 5c20233ba5 | |||
| 3a74fddcf6 | |||
| 839741d36f | |||
| 9080b05b72 | |||
| de0a2cd517 | |||
| 0f038b1de1 | |||
| d7a909da71 | |||
| aeeb24c757 | |||
| 3cc7c68b12 | |||
| 9247016635 | |||
| bc4f50f69b | |||
| 8a0121023e | |||
| 7308d9665d | |||
| 95afa87f71 | |||
| adff5a3a7c | |||
| 9f86d88ec5 | |||
| fd01aac2e7 | |||
| 9d372ffecd | |||
| 5148a0b980 | |||
| a20406b427 | |||
| f74a47f483 | |||
| 1e982d0e82 | |||
| 7fd13d837c | |||
| 932db9813d | |||
| a0202559bc | |||
| c9025d1c74 | |||
| fb57b09e66 | |||
| 9742681c09 | |||
| ca3ab97bee | |||
| 078540697c | |||
| c583e2f029 | |||
| 5a7a7c9fe5 | |||
| 0868535bbe | |||
| 2164621498 | |||
| 2683359460 | |||
| 94a82867fe | |||
| a91d0428df | |||
| 1dee735cdb | |||
| ed36ebb795 | |||
| 10af1803ab | |||
| 9f93ac0e1e | |||
| 66bde4c761 | |||
| 3803fdaf15 | |||
| 847616a295 | |||
| 085e475bd4 | |||
| 273e864e07 | |||
| 46b2761db8 | |||
| 254615894f | |||
| 1aa897e132 | |||
| 8552619bc5 | |||
| 9007a080cf | |||
| 46503af805 | |||
| 758803540b | |||
| 424a7bdcbb | |||
| d44199e592 | |||
| 7d783ced63 | |||
| 85b9250b9a | |||
| b2871f09cd | |||
| 6ff539b4e6 | |||
| e8ea712a45 | |||
| c3c1ddaaf0 | |||
| b89f9650c5 | |||
| b78cea8c35 | |||
| ddea854649 | |||
| 0281273cd0 | |||
| 336a30e7c0 | |||
| 4f9c040d74 | |||
| cdbdbfbb0d | |||
| 63ba6a307b | |||
| bea9181be6 | |||
| 6a62ea8f10 | |||
| f1a0eb88fd | |||
| e43a473559 | |||
| 207e381309 | |||
| 14005e70d9 | |||
| d6b65478ce | |||
| 11aaccdf66 | |||
| 45dd2d2680 | |||
| a1a06e310c | |||
| 716d947914 | |||
| 5076c15e76 | |||
| 2995a3d916 | |||
| d0e259be6f | |||
| b2f621d7d0 | |||
| a2f6492d71 | |||
| c8aa6a8326 | |||
| 9b82355175 |
+5
-2
@@ -5,5 +5,8 @@ src
|
||||
nexe.exe
|
||||
nexe
|
||||
npm-debug.log
|
||||
examples/**/src
|
||||
examples/**/out.nex
|
||||
test/**/src
|
||||
test/**/out.nex
|
||||
test/**/test.nex
|
||||
test/**/tmp
|
||||
test/**/node_modules
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
### Nexe
|
||||
|
||||
[](https://gitter.im/crcn/nexe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://david-dm.org/crcn/nexe)
|
||||
[](http://waffle.io/crcn/nexe)
|
||||
[](https://gitter.im/jaredallard/nexe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://david-dm.org/crcn/nexe)
|
||||
[](http://waffle.io/jaredallard/nexe)
|
||||
|
||||
Nexe is a command-line utility that compiles your Node.js application into a single executable file.
|
||||
|
||||
@@ -134,16 +134,23 @@ Options:
|
||||
var nexe = require('nexe');
|
||||
|
||||
nexe.compile({
|
||||
input: 'input.js',
|
||||
output: 'path/to/bin',
|
||||
nodeVersion: '0.12.5',
|
||||
nodeTempDir: 'src',
|
||||
python: 'path/to/python',
|
||||
resourceFiles: [ 'path/to/a/file' ],
|
||||
flags: true,
|
||||
framework: "nodejs"
|
||||
input: 'input.js', // where the input file is
|
||||
output: 'path/to/bin', // where to output the compiled binary
|
||||
nodeVersion: '5.5.0', // node version
|
||||
nodeTempDir: 'src', // where to store node source.
|
||||
nodeConfigureArgs: ['opt', 'val'], // for all your configure arg needs.
|
||||
nodeMakeArgs: ["-j", "4"], // when you want to control the make process.
|
||||
python: 'path/to/python', // for non-standard python setups. Or python 3.x forced ones.
|
||||
resourceFiles: [ 'path/to/a/file' ], // array of files to embed.
|
||||
flags: true, // use this for applications that need command line flags.
|
||||
jsFlags: "--use_strict", // v8 flags
|
||||
framework: "node" // node, nodejs, or iojs
|
||||
}, function(err) {
|
||||
console.log(err);
|
||||
if(err) {
|
||||
return console.log(err);
|
||||
}
|
||||
|
||||
// do whatever
|
||||
});
|
||||
|
||||
```
|
||||
@@ -153,14 +160,15 @@ nexe.compile({
|
||||
As of 0.4.0 you can now embed nexe options into package.json. Note that this Format
|
||||
is still in works, so it is likely to change.
|
||||
|
||||
```
|
||||
```json
|
||||
"nexe": {
|
||||
"input": "./bin/nexe",
|
||||
"output": "nexe^$",
|
||||
"temp": "src",
|
||||
"runtime": {
|
||||
"framework": "iojs",
|
||||
"version": "2.3.1",
|
||||
"framework": "node",
|
||||
"version": "5.5.0",
|
||||
"js-flags": "--use_strict",
|
||||
"ignoreFlags": true
|
||||
}
|
||||
}
|
||||
@@ -169,9 +177,10 @@ is still in works, so it is likely to change.
|
||||
Notes:
|
||||
|
||||
* output: can use ^$ for platform specific file extension
|
||||
* js-flags: this is also known as v8 flags, and supports *all* v8 flags.
|
||||
|
||||
## Maintainers
|
||||
|
||||
* __Jared Allard__ ([@jaredallard](https://github.com/jaredallard)) <[jaredallard@outlook.com](mailto:jaredallard@outlook.com)> (Active)
|
||||
* __Christopher Karper__ ([@ckarper](https://github.com/CKarper)) <[Christopher.Karper@gmail.com](mailto:Christopher.Karper@gmail.com)> (Active)
|
||||
* __Craig Jefferds__ ([@crcn](https://github.com/crcn)) <[craig.j.condon@gmail.com](mailto:craig.j.condon@gmail.com)> (Not Active)
|
||||
* __Craig Condon__ ([@crcn](https://github.com/crcn)) <[craig.j.condon@gmail.com](mailto:craig.j.condon@gmail.com)> (Old Project Owner)
|
||||
|
||||
@@ -63,7 +63,7 @@ if(argv.h || argv.help) {
|
||||
**/
|
||||
function toAbsolute(pt) {
|
||||
if(pt.substr(0, 1) == "/") return pt;
|
||||
if(pt.substr(1, 3) == ":/") return pt; // for windows "c:/"
|
||||
if(pt.substr(1, 3) == ":/") return pt; // for windows "c:/"
|
||||
return path.join(process.cwd(), pt);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ if(fs.lstatSync(argv.i).isDirectory()) {
|
||||
opts = nexe.package(path.join(argv.i, "package.json"), argv);
|
||||
nexe.compile(opts, function(error) {
|
||||
if(error) {
|
||||
console.log(error.message);
|
||||
return console.log(error.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -89,7 +89,7 @@ if(fs.lstatSync(argv.i).isDirectory()) {
|
||||
},
|
||||
function(error) {
|
||||
if(error) {
|
||||
console.log(error.message);
|
||||
return console.log(error.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
console.log("hello browser!");
|
||||
@@ -1,19 +0,0 @@
|
||||
var nexe = require('../..');
|
||||
|
||||
nexe.compile(
|
||||
{
|
||||
input: "./index.js",
|
||||
output: "./out.nex",
|
||||
nodeVersion: "3.0.0",
|
||||
framework: "iojs",
|
||||
nodeTempDir: "src",
|
||||
python: "python",
|
||||
flags: true,
|
||||
resourceFiles: ["./message.txt"]
|
||||
},
|
||||
function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -1 +0,0 @@
|
||||
Hello World!!!
|
||||
@@ -1,23 +0,0 @@
|
||||
var http = require("http"),
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
nexeres = require("nexeres"),
|
||||
childProc = require("child_process"),
|
||||
port = 1337;
|
||||
|
||||
//Fork a new process to execute the broser.js
|
||||
childProc.fork(path.join(__dirname, "browser.js"));
|
||||
if (false) {
|
||||
require("./browser.js"); //force the bundler to include the .js file
|
||||
}
|
||||
|
||||
//start a web server on specified port (or default if not given)
|
||||
console.log("started HTTP server on port %d", port = Number(process.argv.concat().pop()) || port);
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
//return the embeded file in response to any request
|
||||
|
||||
res.write(nexeres.get("message.txt"));
|
||||
|
||||
res.end();
|
||||
}).listen(port);
|
||||
@@ -1 +0,0 @@
|
||||
hello world!
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"main": "./index.js",
|
||||
"browser": "./index.js"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
console.log("hello browser!");
|
||||
@@ -1,18 +0,0 @@
|
||||
var nexe = require('../..');
|
||||
|
||||
nexe.compile(
|
||||
{
|
||||
input: "./index.js",
|
||||
output: "./out.nex",
|
||||
nodeVersion: "3.0.0",
|
||||
nodeTempDir: "./src",
|
||||
framework: "iojs",
|
||||
python: 'python',
|
||||
flags: true
|
||||
},
|
||||
function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -1,23 +0,0 @@
|
||||
var http = require("http"),
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
nexeres = require("nexeres"),
|
||||
childProc = require("child_process"),
|
||||
port = 1337;
|
||||
|
||||
//Fork a new process to execute the broser.js
|
||||
childProc.fork(path.join(__dirname, "browser.js"));
|
||||
if (false) {
|
||||
require("./browser.js"); //force the bundler to include the .js file
|
||||
}
|
||||
|
||||
//start a web server on specified port (or default if not given)
|
||||
console.log("started HTTP server on port %d", port = Number(process.argv.concat().pop()) || port);
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
//return the embeded file in response to any request
|
||||
|
||||
res.write("Hello, world!");
|
||||
|
||||
res.end();
|
||||
}).listen(port);
|
||||
@@ -1 +0,0 @@
|
||||
hello world!
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"main": "./index.js",
|
||||
"browser": "./index.js"
|
||||
}
|
||||
+68
-145
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright (c) 2013 Craig Condon
|
||||
* Copyright (c) 2015-2016 Jared Allard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -21,165 +22,87 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**/
|
||||
var mdeps = require("module-deps"),
|
||||
through = require("through"),
|
||||
async = require("async"),
|
||||
builtins = require("builtins");
|
||||
|
||||
var _log = require("./log");
|
||||
var mdeps = require("module-deps"),
|
||||
path = require("path"),
|
||||
spawn = require('child_process').spawn,
|
||||
fs = require("fs"),
|
||||
async = require("async"),
|
||||
browserify = require('browserify'),
|
||||
builtins = require("builtins"),
|
||||
_log = require("./log");
|
||||
|
||||
function bundle (input, complete) {
|
||||
/**
|
||||
* User browserify to create a "packed" file.
|
||||
*
|
||||
* @param {String} input - input file
|
||||
* @param {String} nc - node compiler dir
|
||||
* @param {Function} complete - next function to call (async)
|
||||
**/
|
||||
function bundle (input, nc, complete) {
|
||||
var bundlePath = path.join(nc, "lib", "nexe.js");
|
||||
var ws = fs.createWriteStream(bundlePath);
|
||||
var browserifyExec;
|
||||
|
||||
async.waterfall([
|
||||
var browserifyLocations = [ // TODO: Do this programattically.
|
||||
'This is to ignore the 0 location.',
|
||||
path.join(__dirname, '../', 'node_modules/browserify/bin/cmd.js'),
|
||||
path.join(__dirname, '../../', 'node_modules/browserify/bin/cmd.js'),
|
||||
path.join(__dirname, '../../../', 'node_modules/browserify/bin/cmd.js'),
|
||||
path.join(__dirname, '../../../../', 'node_modules/browserify/bin/cmd.js')
|
||||
]
|
||||
|
||||
/**
|
||||
* first we resolve all of the deps
|
||||
*/
|
||||
for(var i = 0; i !== (browserifyLocations.length-1); i++) {
|
||||
if(fs.existsSync(browserifyLocations[i])) {
|
||||
browserifyExec = browserifyLocations[i];
|
||||
_log('found browserify in', browserifyExec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function resolveDeps (next) {
|
||||
var proc = spawn('node', [browserifyExec, '--node', input ]);
|
||||
|
||||
proc.stdout.pipe(ws);
|
||||
|
||||
var deps = [];
|
||||
proc.on('error', function(err) {
|
||||
console.error(err.toString('ascii'));
|
||||
_log('error', 'Failed to invoke browserify');
|
||||
process.exit(1);
|
||||
})
|
||||
|
||||
proc.stderr.on('data', function(data) {
|
||||
console.error(data.toString('ascii'));
|
||||
if(!fs.existsSync(input)) {
|
||||
_log('error', 'Your input file doesn\'t exist!');
|
||||
}
|
||||
_log('error', 'Browserify failed to launch');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
var md = mdeps({
|
||||
xtransform: function (tr, file) {
|
||||
proc.on('close', function(code) {
|
||||
_log("Browserify finished");
|
||||
})
|
||||
|
||||
var buffer = [];
|
||||
console.log(tr);
|
||||
ws.on('error', function(err) {
|
||||
console.log(err);
|
||||
_log('error', 'Failed to save stdout to disk');
|
||||
process.exit(1);
|
||||
})
|
||||
|
||||
ws.on('close', function() {
|
||||
var source = fs.readFileSync(bundlePath, 'utf8');
|
||||
source = source.replace(/[^\x00-\x7F]/g, "");
|
||||
|
||||
return through(write, end);
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
function write (chunk) {
|
||||
buffer.push(chunk.toString());
|
||||
// console.log(chunk.toString(""))
|
||||
console.log(tr);
|
||||
}
|
||||
|
||||
function end() {
|
||||
var content = buffer.join("");
|
||||
// console.log(content);
|
||||
/*
|
||||
// TODO add uglify flag
|
||||
var source = uglify.parse(content, {
|
||||
strict: false
|
||||
});
|
||||
source.figure_out_scope();
|
||||
source.compute_char_frequency();
|
||||
source.mangle_names();
|
||||
|
||||
// TODO - production
|
||||
content = source.print_to_string({
|
||||
ascii_only: true,
|
||||
quote_keys: true
|
||||
});*/
|
||||
|
||||
this.queue(content);
|
||||
this.queue(null);
|
||||
}
|
||||
|
||||
},
|
||||
filter: function (id) {
|
||||
if ([ 'nexeres', 'sys', 'readline' ].indexOf(id) > -1) { return false; }
|
||||
return !~builtins.indexOf(id);
|
||||
},
|
||||
extensions: [ '.js', '.json' ],
|
||||
ignoreMissing: true
|
||||
});
|
||||
|
||||
/** event for missing packages, fixes conditional requires **/
|
||||
md.on('missing', function(id, parent) {
|
||||
_log("warn", "couldn't find require '" + id + "', errors may occur.");
|
||||
});
|
||||
|
||||
md.pipe(through(function (chunk) {
|
||||
deps.push(chunk);
|
||||
}, function () {
|
||||
next(null, deps);
|
||||
}));
|
||||
|
||||
md.end({ file: input })
|
||||
|
||||
},
|
||||
|
||||
function bundleScript (deps, next) {
|
||||
var buffer = [loader.toString()];
|
||||
var dbuffer = [];
|
||||
|
||||
for (var i = deps.length; i--;) {
|
||||
var dep = deps[i];
|
||||
|
||||
var req = "function (require, module, exports, __dirname) { \n"
|
||||
if (dep.id.toLowerCase().indexOf(".json", dep.id.length - 5) !== -1) {
|
||||
//this is the result of require("someFile.json"), so we need to export it from the function
|
||||
req += "module.exports = "
|
||||
}
|
||||
if ((/^\#\!/).test(dep.source)) {
|
||||
dep.source = '//' + dep.source;
|
||||
}
|
||||
|
||||
req += dep.source + "}";
|
||||
|
||||
dbuffer.push(JSON.stringify(dep.id) + ": ["+req+", "+!!dep.entry+", "+JSON.stringify(dep.deps)+"]")
|
||||
// write the source modified to nexe.js
|
||||
fs.writeFile(bundlePath, source, 'utf8', function(err) {
|
||||
if(err) {
|
||||
_log('error', 'failed to save source');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
buffer = ["(" + loader.toString() + ").call(null, {"+dbuffer.join(",")+"}," + JSON.stringify(deps[deps.length-1].id) + ")"].toString();
|
||||
|
||||
next(null, buffer);
|
||||
}
|
||||
], complete)
|
||||
}
|
||||
|
||||
|
||||
var loader = function (deps, key) {
|
||||
var pathModule = global.require("path");
|
||||
var darr = [];
|
||||
var dir = global.require("path").dirname(process.execPath);
|
||||
|
||||
var argv3 = process.argv[3];
|
||||
if (argv3) {
|
||||
argv3 = pathModule.relative(pathModule.dirname(process.execPath), argv3);
|
||||
argv3 = pathModule.resolve(pathModule.dirname(key), argv3);
|
||||
}
|
||||
if (process.argv[2] == "--child_process" && deps[argv3]) {
|
||||
//we've been forked and should run the module specified by argv3[3] instead of the start up module
|
||||
key = argv3;
|
||||
process.argv.splice(2, 2); //restore the argv to [0] = executable, [1] = nexejs
|
||||
}
|
||||
else if (process.argv[2] == "--child_process") {
|
||||
//fork called, but for a module not bundled.
|
||||
argv3 = process.argv[3];
|
||||
process.argv.splice(1, 2); //restore the argv to [0] = executable, [1] = script
|
||||
global.require(argv3);
|
||||
return;
|
||||
}
|
||||
darr.push(deps[key]); //start up module.
|
||||
|
||||
function initModule (dep) {
|
||||
if (dep.module) return dep.module.exports;
|
||||
dep.module = { exports: {} };
|
||||
|
||||
dep[0](function (path) {
|
||||
var rdep = deps[dep[2][path]];
|
||||
var exports = rdep ? rdep.module ? rdep.module.exports : initModule(rdep) : global.require(path);
|
||||
return exports;
|
||||
}, dep.module, dep.module.exports, dir);
|
||||
|
||||
return dep.module.exports;
|
||||
}
|
||||
|
||||
//run the startup module
|
||||
darr.forEach(initModule);
|
||||
|
||||
return darr.filter(function (dep) {
|
||||
return dep[1];
|
||||
}).map(function (dep) {
|
||||
return dep.module || {};
|
||||
}).pop();
|
||||
complete();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = bundle;
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright (c) 2013 Craig Condon
|
||||
* Copyright (c) 2015-2016 Jared Allard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -21,7 +22,7 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
var path = require("path"),
|
||||
fs = require("fs");
|
||||
|
||||
|
||||
+253
-48
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright (c) 2013 Craig Condon
|
||||
* Copyright (c) 2015-2016 Jared Allard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -27,6 +28,7 @@ var async = require("async"),
|
||||
request = require("request"),
|
||||
path = require("path"),
|
||||
fs = require("fs"),
|
||||
colors = require('colors'),
|
||||
ncp = require("ncp").ncp,
|
||||
ProgressBar = require("progress"),
|
||||
child_process = require("child_process"),
|
||||
@@ -51,6 +53,8 @@ var option_list = [
|
||||
"nodeTempDir",
|
||||
"flags",
|
||||
"framework",
|
||||
"nodeConfigureArgs",
|
||||
"nodeMakeArgs",
|
||||
"nodeVersion"
|
||||
]
|
||||
|
||||
@@ -73,12 +77,12 @@ exports.compile = function (options, complete) {
|
||||
process.exit()
|
||||
}
|
||||
|
||||
option_list.forEach(function(v) {
|
||||
/* option_list.forEach(function(v) {
|
||||
if(options[v] === undefined) {
|
||||
_log("error", "option "+v+" was empty")
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
}); */
|
||||
|
||||
/**
|
||||
* Have we been given a custom flag for python executable?
|
||||
@@ -128,7 +132,7 @@ exports.compile = function (options, complete) {
|
||||
|
||||
// continue down along the async road
|
||||
next();
|
||||
})
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
@@ -138,7 +142,7 @@ exports.compile = function (options, complete) {
|
||||
* first download node
|
||||
*/
|
||||
function downloadNode (next) {
|
||||
_downloadNode(version, options.nodeTempDir, next);
|
||||
_downloadNode(version, options.nodeTempDir, options.nodeConfigureArgs, options.nodeMakeArgs, next);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -148,21 +152,7 @@ exports.compile = function (options, complete) {
|
||||
function combineProject (nc, next) {
|
||||
nodeCompiler = nc;
|
||||
_log("bundle %s", options.input);
|
||||
bundle(options.input, next);
|
||||
},
|
||||
|
||||
/**
|
||||
* write the bundle to the lib directory of the target node version
|
||||
*/
|
||||
|
||||
function writeBundle (source, next) {
|
||||
bundlePath = path.join(nodeCompiler.dir, "lib", "nexe.js");
|
||||
_log("bundle -> %s", bundlePath);
|
||||
|
||||
//Remove all non-ascii code from sources
|
||||
source = source.replace(/[^\x00-\x7F]/g, "");
|
||||
// same path as all the other JS files
|
||||
fs.writeFile(bundlePath, source, next);
|
||||
bundle(options.input, nodeCompiler.dir, next);
|
||||
},
|
||||
|
||||
function embedResources(next) {
|
||||
@@ -196,18 +186,45 @@ exports.compile = function (options, complete) {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* monkeypatch child_process.js so nexejs knows when it is a forked process
|
||||
*/
|
||||
function monkeyPatchChildProc(next) {
|
||||
_monkeyPatchChildProcess(nodeCompiler, next);
|
||||
},
|
||||
function monkeyPatchv8FlagsCc (next) {
|
||||
if(options.jsFlags) {
|
||||
return _monkeyPatchv8FlagsCc(nodeCompiler, options, next);
|
||||
}
|
||||
|
||||
return next();
|
||||
},
|
||||
|
||||
/**
|
||||
* monkeypatch child_process.js so nexejs knows when it is a forked process
|
||||
*/
|
||||
function monkeyPatchChildProc(next) {
|
||||
_monkeyPatchChildProcess(nodeCompiler, next);
|
||||
},
|
||||
|
||||
/**
|
||||
* If an old compiled executable exists in the Release directory, delete it.
|
||||
* This lets us see if the build failed by checking the existence of this file later.
|
||||
*/
|
||||
|
||||
function cleanUpOldExecutable (next) {
|
||||
fs.unlink(nodeCompiler.releasePath, function (err) {
|
||||
if (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
next();
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* compile the node application
|
||||
*/
|
||||
|
||||
function makeExe (next) {
|
||||
function makeExecutable (next) {
|
||||
if(isWin) {
|
||||
_log("vcbuild [make stage]");
|
||||
} else {
|
||||
@@ -224,6 +241,25 @@ exports.compile = function (options, complete) {
|
||||
mkdirp(path.dirname(options.output), function(){ next(); });
|
||||
},
|
||||
|
||||
/**
|
||||
* Verify that the executable was compiled successfully
|
||||
*/
|
||||
|
||||
function checkThatExecutableExists (next) {
|
||||
fs.exists(nodeCompiler.releasePath, function (exists) {
|
||||
if (!exists) {
|
||||
_log("error",
|
||||
"The release executable has not been generated. " +
|
||||
"This indicates a failure in the build process. " +
|
||||
"There is likely additional information above."
|
||||
);
|
||||
process.exit(1);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Copy the compilied binary to the output specified.
|
||||
*/
|
||||
@@ -251,14 +287,13 @@ exports.compile = function (options, complete) {
|
||||
* @param {function} complete, callback
|
||||
*/
|
||||
|
||||
function _downloadNode (version, directory, complete) {
|
||||
|
||||
function _downloadNode(version, directory, nodeConfigureArgs, nodeMakeArgs, complete) {
|
||||
var nodeFileDir = path.resolve(path.join(directory, framework, version)), // fixes #107, was process.cwd(), + rest.
|
||||
nodeFilePath = path.resolve(path.join(nodeFileDir, framework + "-" + version + ".tar.gz"));
|
||||
|
||||
|
||||
// might already be downloaded, and unzipped
|
||||
if (_getNodeCompiler(nodeFileDir, complete)) {
|
||||
if (_getNodeCompiler(nodeFileDir, nodeConfigureArgs, nodeMakeArgs, complete)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,11 +316,16 @@ function _downloadNode (version, directory, complete) {
|
||||
function downloadNode (next) {
|
||||
if (fs.existsSync(nodeFilePath)) return next();
|
||||
|
||||
var type = global.type;
|
||||
var url, prefix = "https://"+framework+".org/dist";
|
||||
var uri = framework;
|
||||
|
||||
// pick which url depending on the version
|
||||
if(framework==="nodejs") framework = "node"; // cmon node why can't you stay the same
|
||||
if(framework==="node") {
|
||||
uri = 'nodejs'; // if node, use nodejs uri
|
||||
} else if(framework === 'nodejs') {
|
||||
framework = 'node'; // support nodejs, and node, as framework.
|
||||
}
|
||||
|
||||
var type = global.type;
|
||||
var url, prefix = "https://"+uri+".org/dist";
|
||||
|
||||
if (version === "latest") {
|
||||
url = prefix + "/" + framework + "-" + version + ".tar.gz";
|
||||
@@ -327,6 +367,11 @@ function _downloadNode (version, directory, complete) {
|
||||
tar.stderr.pipe(process.stderr);
|
||||
|
||||
tar.on("close", function () { next(); })
|
||||
tar.on("error", function (err) {
|
||||
console.log(err);
|
||||
_log("error", "failed to extract the node tar file.");
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -335,7 +380,7 @@ function _downloadNode (version, directory, complete) {
|
||||
*/
|
||||
|
||||
function (next, type) {
|
||||
_getNodeCompiler(nodeFileDir, next, type)
|
||||
_getNodeCompiler(nodeFileDir, nodeConfigureArgs, nodeMakeArgs, next, type)
|
||||
},
|
||||
|
||||
], complete);
|
||||
@@ -346,7 +391,7 @@ function _downloadNode (version, directory, complete) {
|
||||
* it.
|
||||
*/
|
||||
|
||||
function _getNodeCompiler (nodeFileDir, complete, type) {
|
||||
function _getNodeCompiler (nodeFileDir, nodeConfigureArgs, nodeMakeArgs, complete, type) {
|
||||
var dir = _getFirstDirectory(nodeFileDir);
|
||||
|
||||
// standard
|
||||
@@ -392,12 +437,19 @@ function _getNodeCompiler (nodeFileDir, complete, type) {
|
||||
version: path.basename(nodeFileDir),
|
||||
releasePath: path.join(dir, "out", "Release", binary),
|
||||
make: function (next) {
|
||||
var cfg = "./configure", configure;
|
||||
if(isPy !== "python") {
|
||||
configure = spawn(isPy, [cfg], { cwd: dir });
|
||||
} else {
|
||||
configure = spawn(cfg, [], { cwd: dir });
|
||||
}
|
||||
var cfg = "./configure",
|
||||
configure;
|
||||
|
||||
var conf = [cfg];
|
||||
|
||||
if(isPy !== "python") {
|
||||
conf = [conf].concat(nodeConfigureArgs);
|
||||
}
|
||||
|
||||
// should work for all use cases now.
|
||||
configure = spawn(isPy, conf, {
|
||||
cwd: dir.toString('ascii')
|
||||
});
|
||||
|
||||
// local function, move to top eventually
|
||||
function _loop(dir) {
|
||||
@@ -432,6 +484,29 @@ function _getNodeCompiler (nodeFileDir, complete, type) {
|
||||
|
||||
configure.stdout.pipe(process.stdout);
|
||||
configure.stderr.pipe(process.stderr);
|
||||
|
||||
// on error
|
||||
configure.on("error", function(err) {
|
||||
console.log('Error:', err);
|
||||
console.log('');
|
||||
console.log('Details:');
|
||||
console.log('command =', isPy, cfg, conf_args || '');
|
||||
console.log('cwd =', dir);
|
||||
|
||||
var configure_path = path.join(dir, 'configure');
|
||||
var contains_configure = fs.existsSync(configure_path);
|
||||
|
||||
console.log('cwd contains configure,', (contains_configure ? colors.green('yes') : colors.red('no')));
|
||||
|
||||
var configure_size = fs.statSync(configure_path).size;
|
||||
|
||||
console.log('configure is non-zero size,', ((configure_size > 0 ) ? colors.green('yes') : colors.red('no')));
|
||||
|
||||
_log("error", "failed to launch configure.");
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// when it's finished
|
||||
configure.on("close", function () {
|
||||
if(isPy !== "python") {
|
||||
/**
|
||||
@@ -444,13 +519,24 @@ function _getNodeCompiler (nodeFileDir, complete, type) {
|
||||
// loop over depends
|
||||
_loop(dir);
|
||||
}
|
||||
|
||||
if(nodeMakeArgs === undefined) {
|
||||
nodeMakeArgs = [];
|
||||
}
|
||||
|
||||
var platformMake = "make";
|
||||
if (os.platform().match(/bsd$/) != null) {
|
||||
platformMake = "gmake";
|
||||
}
|
||||
var make = spawn(platformMake, [], { cwd: dir });
|
||||
|
||||
var make = spawn(platformMake, nodeMakeArgs, { cwd: dir });
|
||||
make.stdout.pipe(process.stdout);
|
||||
make.stderr.pipe(process.stderr);
|
||||
make.on("error", function(err) {
|
||||
console.log(err);
|
||||
_log("error", "failed to run make.");
|
||||
process.exit(1);
|
||||
})
|
||||
make.on("close", function () {
|
||||
next();
|
||||
});
|
||||
@@ -517,7 +603,13 @@ function _monkeyPatchMainJs (compiler, complete) {
|
||||
return ~content.indexOf("nexe");
|
||||
},
|
||||
function (content, next) {
|
||||
next(null, content.replace(/\(function\(process\) \{/,'(function(process) {\n process._eval = \'require("nexe");\';\n process.argv.splice(1, 0, "nexe.js");\n'))
|
||||
next(null, content.replace(/\(function\(process\) \{/,'\
|
||||
(function(process) {\n\
|
||||
process._eval = \'require("nexe");\';\n\
|
||||
if (process.argv[1] !== "nexe.js") {\n\
|
||||
process.argv.splice(1, 0, "nexe.js");\n\
|
||||
}\n\
|
||||
'))
|
||||
},
|
||||
complete
|
||||
);
|
||||
@@ -534,7 +626,7 @@ function _monkeyPatchChildProcess(compiler, complete) {
|
||||
return ~content.indexOf("--child_process");
|
||||
},
|
||||
function (content, next) {
|
||||
next(null, content.replace(/return spawn\(/, 'args.unshift("--child_process");\n return spawn('));
|
||||
next(null, content.replace(/return spawn\(/, 'args.unshift("nexe.js", "--child_process");\n return spawn('));
|
||||
},
|
||||
complete
|
||||
);
|
||||
@@ -554,7 +646,7 @@ function _monkeyPatchMainCc(compiler, complete) {
|
||||
function (content, next) {
|
||||
var lines = content.split('\n');
|
||||
var endLine = lines.indexOf(' option_end_index = i;'); // pre node 0.11.6 compat
|
||||
|
||||
|
||||
if(endLine !== -1) { // check if it succedded or not.
|
||||
lines[endLine] = ' option_end_index = 1;';
|
||||
_log("patched node.cc")
|
||||
@@ -586,6 +678,107 @@ function _monkeyPatchMainCc(compiler, complete) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch flags.cc from deps/v8/src to use hard-coded flags.
|
||||
* this function is very closely ready to accept custom injection code.
|
||||
**/
|
||||
function _monkeyPatchv8FlagsCc(compiler, options, complete) {
|
||||
var mainPath = path.join(compiler.dir, "deps/v8/src", "flags.cc");
|
||||
|
||||
fs.readFile(mainPath, {encoding: 'utf8'}, function(err, contents) {
|
||||
if(err) {
|
||||
return _log('error', 'failed to read', mainPath);
|
||||
}
|
||||
|
||||
// Super simple injection here. Perhaps make it an array at somepoint?
|
||||
var injection = '\
|
||||
const char* nexevargs = "{{args}}";\n\
|
||||
int nexevargslen = strlen(nexevargs);\n\
|
||||
SetFlagsFromString(nexevargs, nexevargslen);\n\
|
||||
';
|
||||
|
||||
var injectionSplit = injection.split('\n');
|
||||
var injectionLength = injectionSplit.length;
|
||||
var contentsSplit = contents.split('\n');
|
||||
var contentsLength = contentsSplit.length;
|
||||
var lastInjectionLine = injectionSplit[injectionLength-2];
|
||||
|
||||
var lineToInjectAfter = contentsSplit.indexOf(' ComputeFlagListHash();');
|
||||
var haveWeInjectedBefore = contentsSplit.indexOf(lastInjectionLine);
|
||||
|
||||
var lineInjectDifference = contentsLength - lineToInjectAfter;
|
||||
|
||||
// support for 0.12.x
|
||||
if(lineToInjectAfter===-1) {
|
||||
_log('warn', 'Using an expiramental support patch for 0.12.x');
|
||||
lineToInjectAfter = contentsSplit.indexOf('#undef FLAG_MODE_DEFINE_IMPLICATIONS');
|
||||
}
|
||||
|
||||
// this is debug, comment out.
|
||||
// _log('v8 injection is', injectionLength, 'newlines long');
|
||||
// _log('v8 flags source is', contentsLength, 'newlines long');
|
||||
|
||||
// console.log(finalContents)
|
||||
|
||||
var finalContents,
|
||||
dontCombine;
|
||||
|
||||
if(lineToInjectAfter !== -1 && haveWeInjectedBefore === -1) {
|
||||
_log('injecting v8 args c++');
|
||||
|
||||
// super debug
|
||||
// _log('v8 injection determined by', lastInjectionLine);
|
||||
// _log('v8 inject after line', lineToInjectAfter);
|
||||
// _log('v8 inject needs to shift', lineInjectDifference, 'amount of lines by', injectionLength);
|
||||
|
||||
// compute out the amount of space we'll need in this.
|
||||
var startShiftLine = contentsLength-1; // minus one to make up for 0 arg line.
|
||||
var endShiftLine = lineToInjectAfter;
|
||||
var injectRoom = injectionLength-1;
|
||||
|
||||
injectionSplit[0] = injectionSplit[0].replace('{{args}}', options.jsFlags);
|
||||
|
||||
for (var i = startShiftLine; i !== endShiftLine; i--) {
|
||||
contentsSplit[i+injectRoom] = contentsSplit[i];
|
||||
contentsSplit[i] = '';
|
||||
}
|
||||
|
||||
var injectionPos = 0;
|
||||
for(var i = 0; i !== injectionLength-1; i++) {
|
||||
contentsSplit[(lineToInjectAfter+1)+injectionPos] = injectionSplit[injectionPos];
|
||||
injectionPos++;
|
||||
}
|
||||
} else if(lineToInjectAfter !== -1 && haveWeInjectedBefore !== -1) {
|
||||
_log('re-injecting v8 args');
|
||||
|
||||
dontCombine = true;
|
||||
finalContents = contentsSplit.join('\n');
|
||||
finalContents = finalContents.replace(/const char\* nexevargs = "[A-Z\-\_]*";/gi,
|
||||
'const char* nexevargs = "'+options.jsFlags+'";');
|
||||
} else {
|
||||
_log('warn', 'failed to find a suitable injection point for v8 args.',
|
||||
'File a bug report with the node version and log.');
|
||||
|
||||
_log('lineToInjectAfter='+lineToInjectAfter, 'haveWeInjectedBefore='+haveWeInjectedBefore);
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
if(!dontCombine) {
|
||||
finalContents = contentsSplit.join('\n');
|
||||
}
|
||||
|
||||
fs.writeFile(mainPath, finalContents, {encoding: 'utf8'}, function(err) {
|
||||
if(err) {
|
||||
_log('error', 'failed to write to', mainPath);
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
return complete();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first directory of a string.
|
||||
*/
|
||||
|
||||
function _getFirstDirectory (dir) {
|
||||
@@ -600,6 +793,7 @@ function _getFirstDirectory (dir) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the progress of a request object.
|
||||
*/
|
||||
|
||||
function _logProgress (req) {
|
||||
@@ -611,7 +805,7 @@ function _logProgress (req) {
|
||||
complete: "=",
|
||||
incomplete: " ",
|
||||
total: len,
|
||||
width: ((isWin) ? 100 : process.stdout.columns - 2) // windows doesn't output colums correctly
|
||||
width: 100 // just use 100
|
||||
});
|
||||
|
||||
req.on("data", function (chunk) {
|
||||
@@ -619,6 +813,12 @@ function _logProgress (req) {
|
||||
});
|
||||
});
|
||||
|
||||
req.on("error", function(err) {
|
||||
console.log(err);
|
||||
_log("error", "failed to download node sources,");
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -627,8 +827,9 @@ function _logProgress (req) {
|
||||
*
|
||||
* @param {string} path - path to package.json
|
||||
* @param {object} options - fallback options
|
||||
*
|
||||
*
|
||||
* @todo implement options overriding package defaults.
|
||||
* @todo make this much less hackily implemented....
|
||||
*
|
||||
* @return {object} nexe.compile options object
|
||||
**/
|
||||
@@ -653,9 +854,13 @@ exports.package = function(path, options) {
|
||||
var obj = {
|
||||
input: (_package.nexe.input || options.i),
|
||||
output: (_package.nexe.output || options.o),
|
||||
flags: (_package.nexe.runtime.ignoreFlags || options.f),
|
||||
flags: (_package.nexe.runtime.ignoreFlags || (options.f || false)),
|
||||
nodeMakeArgs: (_package.nexe.runtime.nodeMakeArgs || []),
|
||||
resourceFiles: (_package.nexe.resourceFiles),
|
||||
nodeVersion: (_package.nexe.runtime.version || options.r),
|
||||
nodeConfigureArgs: (_package.nexe.runtime.nodeConfigureArgs || []),
|
||||
nodeMakeArgs: (_package.nexe.runtime.nodeMakeArgs || []),
|
||||
jsFlags: (_package.nexe.runtime['js-flags'] || false),
|
||||
python: (_package.nexe.python || options.p),
|
||||
nodeTempDir: (_package.nexe.temp || options.t),
|
||||
framework: (_package.nexe.runtime.framework || options.f)
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright (c) 2013 Craig Condon
|
||||
* Copyright (c) 2015-2016 Jared Allard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -22,6 +23,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
var colors = require('colors');
|
||||
|
||||
/**
|
||||
* standard output, takes 3 different types.
|
||||
* log, error, and warn
|
||||
@@ -31,8 +34,6 @@
|
||||
**/
|
||||
function _log () {
|
||||
|
||||
var colors = require('colors');
|
||||
|
||||
var args = Array.prototype.slice.call(arguments, 0),
|
||||
level = args.shift();
|
||||
|
||||
|
||||
+18
-14
@@ -3,7 +3,7 @@
|
||||
"name": "nexe",
|
||||
"description": "create single executables out of your [node/io].js applications",
|
||||
"license": "MIT",
|
||||
"version": "0.4.1",
|
||||
"version": "1.0.7",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Criag Condon",
|
||||
@@ -17,34 +17,38 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"async": "1.2.1",
|
||||
"builtins": "1.0.1",
|
||||
"colors": "^1.0.3",
|
||||
"glob": "^5.0.5",
|
||||
"mkdirp": "^0.5.0",
|
||||
"module-deps": "^3.6.4",
|
||||
"async": "1.5.2",
|
||||
"browserify": "^13.0.0",
|
||||
"builtins": "1.0.3",
|
||||
"colors": "^1.1.2",
|
||||
"glob": "^6.0.4",
|
||||
"insert-module-globals": "^7.0.1",
|
||||
"mkdirp": "^0.5.1",
|
||||
"module-deps": "^4.0.5",
|
||||
"ncp": "^2.0.0",
|
||||
"outcome": "0.0.18",
|
||||
"progress": "^1.1.8",
|
||||
"request": "^2.53.0",
|
||||
"request": "^2.67.0",
|
||||
"sprintf": "~0.1.5",
|
||||
"step": "0.0.x",
|
||||
"tar.gz": "0.1.1",
|
||||
"through": "^2.3.6",
|
||||
"yargs": "^3.2.1"
|
||||
"tar.gz": "1.0.2",
|
||||
"yargs": "^3.32.0"
|
||||
},
|
||||
"nexe": {
|
||||
"input": "./bin/nexe",
|
||||
"output": "nexe^$",
|
||||
"temp": "src",
|
||||
"runtime": {
|
||||
"framework": "iojs",
|
||||
"version": "2.3.1",
|
||||
"framework": "nodejs",
|
||||
"version": "5.5.0",
|
||||
"ignoreFlags": true
|
||||
}
|
||||
},
|
||||
"preferGlobal": "true",
|
||||
"preferGlobal": true,
|
||||
"bin": {
|
||||
"nexe": "./bin/nexe"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodeunit": "^0.9.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Test to verify if we support strict mode (flags)
|
||||
*
|
||||
* @author Jared Allard <jaredallard@outlook.com>
|
||||
* @version 0.0.1
|
||||
* @license MIT
|
||||
**/
|
||||
|
||||
// "use strict"; w/o --use_strict
|
||||
|
||||
var isStrict = (function() { return !this; })();
|
||||
|
||||
console.log('test:strict-mode:status =', isStrict);
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "flags-test",
|
||||
"nexe": {
|
||||
"input": "./index.js",
|
||||
"output": "test.nex",
|
||||
"temp": "src",
|
||||
"runtime": {
|
||||
"framework": "node",
|
||||
"version": "0.10.0",
|
||||
"ignoreFlags": false,
|
||||
"js-flags": "--use_strict",
|
||||
"node-args": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
var gulp = require('gulp');
|
||||
var nexe = require('nexe');
|
||||
|
||||
gulp.task( "compile", ( callback ) => {
|
||||
let options = {
|
||||
input: "index.js",
|
||||
output: "test.nex",
|
||||
python: "python",
|
||||
nodeTempDir: "./tmp",
|
||||
nodeVersion: "latest",
|
||||
flags: false,
|
||||
framework: "nodejs"
|
||||
};
|
||||
|
||||
nexe.compile( options, ( err ) => {
|
||||
console.log( err );
|
||||
callback( err );
|
||||
} );
|
||||
} );
|
||||
|
||||
gulp.task('default', ['compile']);
|
||||
@@ -0,0 +1 @@
|
||||
console.log('Hello, world!');
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "gulp-test-170",
|
||||
"version": "0.0.1",
|
||||
"description": "gulpfile.js issue #170",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Jared Allard <jaredallard@outlook.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"gulp": "^3.9.0",
|
||||
"nexe": "^1.0.5"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user