Socket
Socket
Sign inDemoInstall

0x

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

0x - npm Package Compare versions

Comparing version 4.4.2 to 4.4.3

18

index.js

@@ -7,3 +7,2 @@ 'use strict'

const fs = require('fs')
const { promisify } = require('util')
const validate = require('./lib/validate')(require('./schema.json'))

@@ -14,2 +13,3 @@ const traceStacksToTicks = require('./lib/trace-stacks-to-ticks')

const render = require('./lib/render')
const { pathTo } = require('./lib/util')

@@ -24,2 +24,7 @@ const platform = process.platform

args.status = args.status || noop
args.pathToNodeBinary = args.pathToNodeBinary || process.execPath
if (args.pathToNodeBinary === 'node') {
args.pathToNodeBinary = pathTo('node')
}
validate(args)

@@ -34,4 +39,3 @@ const { collectOnly, visualizeOnly, treeDebug, mapFrames } = args

args.title = args.title || `node ${args.argv.join(' ')}`
const binary = args.pathToNodeBinary
var { ticks, pid, folder, inlined } = await startProcessAndCollectTraceData(args, binary)
var { ticks, pid, folder, inlined } = await startProcessAndCollectTraceData(args)

@@ -61,3 +65,3 @@ if (treeDebug === true) {

async function startProcessAndCollectTraceData (args, binary) {
async function startProcessAndCollectTraceData (args) {
if (!Array.isArray(args.argv)) {

@@ -69,6 +73,6 @@ throw Error('argv option is required')

switch (args.kernelTracing ? platform : 'v8') {
case 'v8': return v8(args, binary)
case 'linux': return linux(args, await isSudo(), binary)
case 'v8': return v8(args)
case 'linux': return linux(args, await isSudo())
case 'win32': return windows()
default: return sun(args, await isSudo(), binary)
default: return sun(args, await isSudo())
}

@@ -75,0 +79,0 @@ }

@@ -48,4 +48,5 @@ 'use strict'

cb()
} else {
cb(errMsg, _, cb)
}
else cb(errMsg, _, cb)
}), process.stderr)

@@ -52,0 +53,0 @@ }

{
"name": "0x",
"version": "4.4.2",
"version": "4.4.3",
"description": "🔥 single-command flamegraph profiling 🔥",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,4 +19,4 @@ 'use strict'

function linux (args, sudo, binary, cb) {
const { status, outputDir, workingDir, name, onPort } = args
function linux (args, sudo, cb) {
const { status, outputDir, workingDir, name, onPort, pathToNodeBinary } = args
var perf = pathTo('perf')

@@ -27,6 +27,5 @@ if (!perf) return void cb(Error('Unable to locate perf - make sure it\'s in your PATH'))

return spawn('sudo', ['true'])
.on('exit', function () { linux(args, true, binary, cb) })
.on('exit', function () { linux(args, true, cb) })
}
var node = !binary || binary === 'node' ? pathTo('node') : binary
var uid = parseInt(Math.random() * 1e9, 10).toString(36)

@@ -48,3 +47,3 @@ var perfdat = '/tmp/perf-' + uid + '.data'

'--',
node,
pathToNodeBinary,
'--perf-basic-prof',

@@ -51,0 +50,0 @@ '-r', path.join(__dirname, '..', 'lib', 'preload', 'soft-exit'),

@@ -20,4 +20,4 @@ 'use strict'

function sun (args, sudo, binary, cb) {
const { status, outputDir, workingDir, name, onPort } = args
function sun (args, sudo, cb) {
const { status, outputDir, workingDir, name, onPort, pathToNodeBinary } = args

@@ -30,5 +30,4 @@ var dtrace = pathTo('dtrace')

return spawn('sudo', ['true'])
.on('exit', function () { sun(args, true, binary, cb) })
.on('exit', function () { sun(args, true, cb) })
}
var node = !binary || binary === 'node' ? pathTo('node') : binary
var kernelTracingDebug = args.kernelTracingDebug

@@ -42,3 +41,3 @@

var proc = spawn(node, args, {
var proc = spawn(pathToNodeBinary, args, {
stdio: ['ignore', 'inherit', 'inherit', 'ignore', 'ignore', 'pipe']

@@ -45,0 +44,0 @@ }).on('exit', function (code) {

@@ -17,3 +17,2 @@ 'use strict'

getTargetFolder,
pathTo,
spawnOnPort,

@@ -25,7 +24,6 @@ when

async function v8 (args, binary) {
const { status, outputDir, workingDir, name, onPort } = args
async function v8 (args) {
const { status, outputDir, workingDir, name, onPort, pathToNodeBinary } = args
var node = !binary || binary === 'node' ? await pathTo('node') : binary
var proc = spawn(node, [
let proc = spawn(pathToNodeBinary, [
'--prof',

@@ -118,3 +116,3 @@ `--logfile=%p-v8.log`,

return {
ticks: await v8LogToTicks(isolateLogPath, node),
ticks: await v8LogToTicks(isolateLogPath, pathToNodeBinary),
inlined: inlined,

@@ -139,6 +137,6 @@ pid: proc.pid,

function collectInliningInfo (sp) {
var root
var stdoutIsPrintOptSourceOutput = false
var lastOptimizedFrame = null
var inlined = {}
let root
let stdoutIsPrintOptSourceOutput = false
let lastOptimizedFrame = null
let inlined = {}
pump(sp.stdout, split(), through((s, _, cb) => {

@@ -145,0 +143,0 @@ s += '\n'

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