Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
es-host-wrapper
Advanced tools
Es-host-wrapper is a library for executing ECMAScript code uniformly across any ECMAScript host environment. Es-host-wrapper consists of a wrapper around the various ways of executing a host and processing its output (called a Runner) and a runtime library for host-agnostic scripts to use.
For a CLI tool that uses this library to make comparing ECMAScript hosts super easy, see eshost.
npm install es-host-wrapper
Host | Supported Platforms | Download | Notes |
---|---|---|---|
browser | Any | Errors reported from Microsoft Edge are all of type Error. | |
node | Any | https://nodejs.org | |
ch | Windows | Built from source | Chakra console host. |
d8 | Any | Built from source | v8 console host. Errors are reported on stdout. Use $.getGlobal and $.setGlobal to get and set properties of global objects in other realms. |
jsshell | Any | Download | SpiderMonkey console host. |
jsc | Mac | Built from source¹ | |
nashorn | Any | Built from source |
1: Also available on your Mac system at /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc
.
const runner = js.getRunner('path/to/d8.exe', 'd8');
runner.exec(`
print(1+1);
`).then(result => console.log(result.stdout));
Gets an instance of a runner for a particular host type. Supported host types:
Creating a runner may start the host (eg. for the browser, creating the host executes the browser process).
You can pass command line arguments to the host process using the arguments option. It is an array of strings as you might pass to Node's spawn API.
Executes code
in the host. Returns a result object.
An object with the following keys:
print
).The error object is similar to the error object you get in the host itself. Namely, it has the following keys:
Prints str
to stdout.
A reference to the global object.
Creates a new realm, returning that realm's runtime library ($).
For example, creating two nested realms:
$sub = $.createRealm();
$subsub = $sub.createRealm();
Creates a new realm and evals code
in that realm. If an error is thrown, it will be passed to the onError callback.
Creates a new script and evals code
in that realm. If an error is thrown, it will be passed to the onError callback.
Scripts are different from eval in that lexical bindings go into the global lexical contour rather than being scoped to the eval.
Gets a global property name.
Sets a global property name to value.
FAQs
Invoke ECMAScript scripts in any command line JS engine.
The npm package es-host-wrapper receives a total of 1 weekly downloads. As such, es-host-wrapper popularity was classified as not popular.
We found that es-host-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.