New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

isolated-vm

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isolated-vm - npm Package Compare versions

Comparing version 4.4.2 to 4.5.0

src/isolate/cpu_profile_manager.cc

44

isolated-vm.d.ts

@@ -109,2 +109,21 @@ declare module "isolated-vm" {

getHeapStatisticsSync(): HeapStatistics;
/**
* Start profiling against the isolate with a specific title
*
* @param title the profile title
*/
startCpuProfiler(title: string): void;
/**
* Stop profiling against the isolate with a specific title
* that started via `startCpuProfiler`. It will return more
* than one cpu profiles because isolate can be run in different
* threads. The `ThreadCpuProfile` contains the `thread_id` that
* the isolate was running in.
*
* @param title
*/
stopCpuProfiler(title: string): Promise<ThreadCpuProfile[]>;
}

@@ -591,2 +610,27 @@

export type ThreadCpuProfile = {
threadId: number;
profile: CpuProfile;
}
export type CpuProfile = {
startTime: number;
endTime: number;
samples: number[];
timeDeltas: number[];
nodes: Array<{
id: number;
hitCount: number;
children: number[];
callFrame: {
functionName: string;
url: string;
scriptId: number;
lineNubmer: number;
columnNumber: number;
bailoutReason?: string;
};
}>;
}
export type InspectorSession = {

@@ -593,0 +637,0 @@ dispatchProtocolMessage(message: string): void;

2

package.json
{
"name": "isolated-vm",
"version": "4.4.2",
"version": "4.5.0",
"description": "Access to multiple isolates",

@@ -5,0 +5,0 @@ "main": "isolated-vm.js",

@@ -256,3 +256,13 @@ [![npm version](https://badgen.now.sh/npm/v/isolated-vm)](https://www.npmjs.com/package/isolated-vm)

##### `isolate.startCpuProfiler(title)` *[void]*
Start a CPU profiler in the isolate, for performance profiling. It only collects cpu profiles when
the isolate is active in a thread.
##### `isolate.stopCpuProfiler(title)` *[Promise<Array<ThreadCpuProfile>>]*
Stop a CPU profiler previously started using the same title. It returns an array of profiles dependening
on how many times the isolate get activated in a thread.
* **return** An array of [`ThreadCpuProfile`](#thread-cpu-profile) objects.
### Class: `Context` *[transferable]*

@@ -562,3 +572,2 @@ A context is a sandboxed execution environment within an isolate. Each context contains its own

### Shared Options

@@ -612,2 +621,33 @@ Many methods in this library accept common options between them. They are documented here instead of

##### `ThreadCpuProfile`
It's a object that contains a thread id and a [CpuProfile](#cpuprofile) info.
* `threadId` *[number]* - The thread that isolate runs on.
* `profile` *[CpuProfile]* - The [CpuProfile](#cpuprofile).
##### `CpuProfile`
The CpuProfile Object that can be `JSON.stringify(cpuProfile)`, and save to any external file system
for later reloaded into chrome dev tool or any other js performance tool to review.
The format should matches the definition in: https://chromedevtools.github.io/devtools-protocol/tot/Profiler/#type-Profile
* `startTime` *[number]* - The start timestamp when calling `.startProfiling`.
* `endTime` *[number]* - The end timestamp when calling `.stopProfiling`,
* `samples` *[Array<number>]* - All sample node id has been collected.
* `timeDeltas` *[Array<number>]* - All the time deltas related to the `samples`.
* `nodes` *[Array<Node>]*
* `hitCount` *[number]*
* `id` *[id]*
* `children` *[Array<number>]*
* `callFrame` *[CallFrame]*
* `functionName` *[string]*
* `url` *[string]* - The `filename` used in [`ScriptOrigin`](#scriptorigin)
* `scriptId` *[number]*
* `lineNumber` *[number]*
* `columnNumber` *[number]*
* `bailoutReason` *[string?]* - When the JavaScript function bailed out from v8 optimization,
this field will present.
EXAMPLES

@@ -614,0 +654,0 @@ --------

@@ -61,3 +61,3 @@ 'use strict';

// Check module cached data
if (V8_AT_LEAST(6, 9, 37)) {
{
const cachedData = (() => {

@@ -64,0 +64,0 @@ const isolate = new ivm.Isolate;

@@ -5,8 +5,6 @@ const { V8_AT_LEAST } = require('./lib/v8-version');

if (V8_AT_LEAST(8, 0, 160)) {
const isolate = new ivm.Isolate;
const context = isolate.createContextSync();
context.evalSync('eval("1".repeat(40).repeat(1e3))');
assert.throws(() => context.evalSync('eval("1".repeat(40).repeat(1e7))'));
}
const isolate = new ivm.Isolate;
const context = isolate.createContextSync();
context.evalSync('eval("1".repeat(40).repeat(1e3))');
assert.throws(() => context.evalSync('eval("1".repeat(40).repeat(1e7))'));
console.log('pass');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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