Comparing version 1.0.8 to 2.0.0
45
index.js
@@ -1,1 +0,44 @@ | ||
exports.fetch = require('./fetch'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const exec = require('child_process').exec; | ||
const nodePath = process.execPath; | ||
const version = process.versions.v8; | ||
const tmpfile = path.join(__dirname, version+'.flags.json'); | ||
const exclusions = ['--help']; | ||
module.exports = function (cb) { | ||
if (fs.existsSync(tmpfile)) { | ||
process.nextTick(function () { | ||
cb(null, require(tmpfile)) | ||
}); | ||
} else { | ||
exec('"'+nodePath+'" --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); | ||
} | ||
} | ||
); | ||
} | ||
}); | ||
} | ||
}; |
{ | ||
"name": "v8flags", | ||
"description": "Get available v8 flags.", | ||
"version": "1.0.8", | ||
"version": "2.0.0", | ||
"homepage": "https://github.com/tkellen/node-v8flags", | ||
@@ -24,3 +24,2 @@ "author": { | ||
"scripts": { | ||
"install": "node fetch.js", | ||
"test": "mocha -R spec test.js" | ||
@@ -27,0 +26,0 @@ }, |
@@ -10,12 +10,14 @@ # 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) | ||
v8flags.fetch(); // [ '--use_strict', | ||
// '--es5_readonly', | ||
// '--es52_globals', | ||
// '--harmony_typeof', | ||
// '--harmony_scoping', | ||
// '--harmony_modules', | ||
// '--harmony_proxies', | ||
// '--harmony_collections', | ||
// '--harmony', | ||
// ... | ||
v8flags(function (err, results) { | ||
console.log(results); // [ '--use_strict', | ||
// '--es5_readonly', | ||
// '--es52_globals', | ||
// '--harmony_typeof', | ||
// '--harmony_scoping', | ||
// '--harmony_modules', | ||
// '--harmony_proxies', | ||
// '--harmony_collections', | ||
// '--harmony', | ||
// ... | ||
}); | ||
``` | ||
@@ -25,2 +27,3 @@ | ||
* 2015-01-15 - v2.0.0 - make the stupid thing async | ||
* 2014-12-22 - v1.0.8 - exclude `--help` flag | ||
@@ -27,0 +30,0 @@ * 2014-12-20 - v1.0.7 - pre-cache flags for every version of node from 0.8 to 0.11 |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38
0
1
4654
5
40
2