Comparing version 2.0.0 to 2.0.2
54
index.js
@@ -0,44 +1,36 @@ | ||
const os = require('os'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const execFile = require('child_process').execFile; | ||
const exec = require('child_process').exec; | ||
const nodePath = process.execPath; | ||
const version = process.versions.v8; | ||
const tmpfile = path.join(__dirname, version+'.flags.json'); | ||
const tmpfile = path.join(os.tmpdir(), process.versions.v8+'.flags.json'); | ||
const exclusions = ['--help']; | ||
module.exports = function (cb) { | ||
if (fs.existsSync(tmpfile)) { | ||
process.nextTick(function () { | ||
cb(null, require(tmpfile)) | ||
try { | ||
var flags = require(tmpfile); | ||
process.nextTick(function(){ | ||
cb(null, flags); | ||
}); | ||
} else { | ||
exec('"'+nodePath+'" --v8-options', function (execErr, result) { | ||
} catch (e) { | ||
execFile(process.execPath, ['--v8-options'], function (execErr, result) { | ||
var flags; | ||
if (execErr) { | ||
cb(execErr) | ||
} else { | ||
flags = result.match(/\s\s--(\w+)/gm).map(function (match) { | ||
return match.substring(2); | ||
}).filter(function (name) { | ||
return exclusions.indexOf(name) === -1; | ||
}); | ||
fs.writeFile( | ||
tmpfile, | ||
JSON.stringify(flags), | ||
{ encoding:'utf8' }, | ||
function (writeErr) { | ||
if (writeErr) { | ||
cb(writeErr); | ||
} else { | ||
console.log('flags for v8 '+version+' cached.'); | ||
cb(null, flags); | ||
} | ||
return cb(execErr); | ||
} | ||
flags = result.match(/\s\s--(\w+)/gm).map(function (match) { | ||
return match.substring(2); | ||
}).filter(function (name) { | ||
return exclusions.indexOf(name) === -1; | ||
}); | ||
fs.writeFile(tmpfile, JSON.stringify(flags), { encoding:'utf8' }, | ||
function (writeErr) { | ||
if (writeErr) { | ||
return cb(writeErr); | ||
} | ||
); | ||
} | ||
cb(null, flags); | ||
} | ||
); | ||
}); | ||
} | ||
}; |
{ | ||
"name": "v8flags", | ||
"description": "Get available v8 flags.", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"homepage": "https://github.com/tkellen/node-v8flags", | ||
@@ -28,3 +28,3 @@ "author": { | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 0.10.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "keywords": [ |
@@ -26,2 +26,4 @@ # v8flags [![Build Status](https://secure.travis-ci.org/tkellen/node-v8flags.png)](http://travis-ci.org/tkellen/node-v8flags) [![Build status](https://ci.appveyor.com/api/projects/status/5jpe6yawxdllrok4?svg=true)](https://ci.appveyor.com/project/tkellen/node-v8flags) | ||
* 2015-01-18 - v2.0.2 - keep his dark tentacles contained | ||
* 2015-01-15 - v2.0.1 - store temp file in `os.tmpdir()`, drop support for node 0.8 | ||
* 2015-01-15 - v2.0.0 - make the stupid thing async | ||
@@ -28,0 +30,0 @@ * 2014-12-22 - v1.0.8 - exclude `--help` flag |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40
4640
34