Socket
Socket
Sign inDemoInstall

v8flags

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v8flags - npm Package Compare versions

Comparing version 1.0.8 to 2.0.0

LICENSE

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);
}
}
);
}
});
}
};

3

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc