This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
var nexe = require('nexe');
|
||||||
|
|
||||||
|
nexe.compile(
|
||||||
|
{
|
||||||
|
input: "./index.js",
|
||||||
|
output: "./out.exe",
|
||||||
|
nodeVersion: "latest",
|
||||||
|
nodeTempDir: "",
|
||||||
|
python: "C:\\Python27\\python.exe",
|
||||||
|
flags: true
|
||||||
|
},
|
||||||
|
function (err) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{ "head": "Success!" }
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
if(false) {
|
||||||
|
require('./not-found-file.json');
|
||||||
|
}
|
||||||
|
|
||||||
|
var out = require('./found-file.json');
|
||||||
|
|
||||||
|
console.log(out.head);
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
all:
|
||||||
|
nexe -i ./ -o ./hello-world.nex
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"main": "./index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"nexe": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
console.log("hello browser!");
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
var nexe = require('nexe');
|
||||||
|
|
||||||
|
nexe.compile(
|
||||||
|
{
|
||||||
|
input: "./index.js",
|
||||||
|
output: "./hellowWorld.exe",
|
||||||
|
nodeVersion: "0.10.33",
|
||||||
|
nodeTempDir: "",
|
||||||
|
flags: true,
|
||||||
|
resourceFiles: ["./message.txt"]
|
||||||
|
},
|
||||||
|
function (err) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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);
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
all:
|
||||||
|
nexe -i ./ -o ./hello-world.nex -r 0.8.18
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
hello world!
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"main": "./index.js",
|
||||||
|
"browser": "./index.js"
|
||||||
|
}
|
||||||
@@ -6,9 +6,7 @@ nexe.compile(
|
|||||||
output: "",
|
output: "",
|
||||||
nodeVersion: "0.10.33",
|
nodeVersion: "0.10.33",
|
||||||
nodeTempDir: "",
|
nodeTempDir: "",
|
||||||
python: "C:\\Python27\\python.exe",
|
flags: true
|
||||||
flags: true,
|
|
||||||
resourceFiles: ["./message.txt"]
|
|
||||||
},
|
},
|
||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ console.log("started HTTP server on port %d", port = Number(process.argv.concat(
|
|||||||
http.createServer(function(req, res) {
|
http.createServer(function(req, res) {
|
||||||
//return the embeded file in response to any request
|
//return the embeded file in response to any request
|
||||||
|
|
||||||
res.write(nexeres.get("message.txt"));
|
res.write("Hello, world!");
|
||||||
|
|
||||||
res.end();
|
res.end();
|
||||||
}).listen(port);
|
}).listen(port);
|
||||||
|
|||||||
+13
-5
@@ -1,15 +1,16 @@
|
|||||||
var mdeps = require("module-deps"),
|
var mdeps = require("module-deps"),
|
||||||
through = require("through"),
|
through = require("through"),
|
||||||
async = require("async"),
|
async = require("async"),
|
||||||
//uglify = require("uglify-js"),
|
|
||||||
builtins = require("builtins");
|
builtins = require("builtins");
|
||||||
|
|
||||||
|
var _log = require("./log");
|
||||||
|
|
||||||
function bundle (input, complete) {
|
function bundle (input, complete) {
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* first we resolve all of the deps
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function resolveDeps (next) {
|
function resolveDeps (next) {
|
||||||
@@ -39,9 +40,9 @@ function bundle (input, complete) {
|
|||||||
function end() {
|
function end() {
|
||||||
var content = buffer.join("");
|
var content = buffer.join("");
|
||||||
// console.log(content);
|
// console.log(content);
|
||||||
|
/*
|
||||||
|
// TODO add uglify flag
|
||||||
/*var source = uglify.parse(content, {
|
var source = uglify.parse(content, {
|
||||||
strict: false
|
strict: false
|
||||||
});
|
});
|
||||||
source.figure_out_scope();
|
source.figure_out_scope();
|
||||||
@@ -63,8 +64,15 @@ function bundle (input, complete) {
|
|||||||
if (id == 'nexeres') { return false; } //treat our new moudle as a builtin module
|
if (id == 'nexeres') { return false; } //treat our new moudle as a builtin module
|
||||||
return !~builtins.indexOf(id);
|
return !~builtins.indexOf(id);
|
||||||
},
|
},
|
||||||
extensions: ['.js', '.json' ]
|
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) {
|
md.pipe(through(function (chunk) {
|
||||||
deps.push(chunk);
|
deps.push(chunk);
|
||||||
}, function () {
|
}, function () {
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ exports.compile = function (options, complete) {
|
|||||||
/*
|
/*
|
||||||
* Have we been given a custom flag for python executable?
|
* Have we been given a custom flag for python executable?
|
||||||
*/
|
*/
|
||||||
if(options.python!=='python' && options.python!=="") {
|
if(options.python!=='python' && options.python!=="" && options.python!==undefined) {
|
||||||
if(isWin) {
|
if(isWin) {
|
||||||
isPy=options.python.replace(/\//gm, "\\"); // use windows file paths, batch is sensitive.
|
isPy=options.python.replace(/\//gm, "\\"); // use windows file paths, batch is sensitive.
|
||||||
} else {
|
} else {
|
||||||
@@ -150,7 +150,7 @@ exports.compile = function (options, complete) {
|
|||||||
_log("cp %s %s", nodeCompiler.releasePath, options.output);
|
_log("cp %s %s", nodeCompiler.releasePath, options.output);
|
||||||
ncp(nodeCompiler.releasePath, options.output, function (err) {
|
ncp(nodeCompiler.releasePath, options.output, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log("* NOTICE * Failed to copy binary. Did the build fail?");
|
_log("error", "Couldn't copy binary.");
|
||||||
throw err; // dump raw error object
|
throw err; // dump raw error object
|
||||||
}
|
}
|
||||||
_log('copied');
|
_log('copied');
|
||||||
|
|||||||
+10
-1
@@ -1,10 +1,13 @@
|
|||||||
module.exports = _log;
|
module.exports = _log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* logging aka stdout wrapper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function _log () {
|
function _log () {
|
||||||
|
|
||||||
|
var colors = require('colors');
|
||||||
|
|
||||||
var args = Array.prototype.slice.call(arguments, 0),
|
var args = Array.prototype.slice.call(arguments, 0),
|
||||||
level = args.shift();
|
level = args.shift();
|
||||||
|
|
||||||
@@ -13,7 +16,13 @@ function _log () {
|
|||||||
level = "log";
|
level = "log";
|
||||||
}
|
}
|
||||||
|
|
||||||
args[0] = "----> " + args[0];
|
if(level == "log") {
|
||||||
|
args[0] = "----> " + args[0];
|
||||||
|
} else if(level == "error") {
|
||||||
|
args[0] = "....> " + colors.red("ERROR: ") + args[0]
|
||||||
|
} else if(level == "warn") {
|
||||||
|
args[0] = "....> " + colors.yellow("WARNING: ") + args[0]
|
||||||
|
}
|
||||||
|
|
||||||
console[level].apply(console, args);
|
console[level].apply(console, args);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user