
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@esmbly/core
Advanced tools
A composable transpiler infrastructure for working with statically typed JavaScript and WebAssembly
@esmbly/core
The core of Esmbly.
This package is used by @esmbly/cli
to parse the input files into AST representations and to run each provided transformer. It can also be used to run Esmbly programmatically.
Note: If you want to run the CLI you should install
@esmbly/cli
instead.
# Using Yarn:
yarn add @esmbly/core
# Or, using NPM:
npm install @esmbly/core --save
const esmbly = require('@esmbly/core');
const Flow = require('@esmbly/transformer-flow');
const Wasm = require('@esmbly/transformer-wasm');
const compile = content => {
return esmbly.run({
input: [
{
content,
dir: '/',
name: 'input',
type: '.js',
},
],
output: [{ format: 'WebAssembly' }],
transformers: [
Flow.createTransformer(),
Wasm.createTransformer()
],
});
};
const program = `
// @flow
export function add(a: number, b: number): number {
return a + b;
}
`;
compile(program)
.then(([{ content }]) => WebAssembly.instantiate(content, {}))
.then(({ instance }) => console.log('2 + 3 = ' + instance.exports.add(2, 3))) // => 2 + 3 = 5
.catch(err => console.log(err));
The @esmbly/core
API is very minimal. It exposes a single function called run
which accepts a config object (see the RunConfig interface) where the following properties must be provided.
Option | Description | Type |
---|---|---|
input | An array of files that should be transformed | File[] |
transformers | An array of transformer instances (created using the createTransformer() method, or any object/class that implements the Transformer interface). The transformers will run in the order that they are specified. | Transformer[] |
output | An array of output objects. In other words - what kind of files do you want to output? | Output[] |
interface File {
name: string;
content: string | Buffer;
dir: string;
type: FileType;
}
interface Output {
format: Format;
outDir?: string;
outFile?: string;
rootDir?: string;
}
All types of contributions are very much welcome. Check out our Contributing Guide for instructions on how to get started.
FAQs
A composable transpiler infrastructure for working with statically typed JavaScript and WebAssembly
The npm package @esmbly/core receives a total of 8 weekly downloads. As such, @esmbly/core popularity was classified as not popular.
We found that @esmbly/core 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.