Socket
Socket
Sign inDemoInstall

metro-hermes-compiler

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-hermes-compiler

🚇 Hermes bytecode compiler for Metro.


Version published
Weekly downloads
495K
increased by4.83%
Maintainers
2
Weekly downloads
 
Created

What is metro-hermes-compiler?

The metro-hermes-compiler package is a tool used to compile JavaScript code into bytecode that can be executed by the Hermes JavaScript engine. Hermes is an open-source JavaScript engine optimized for running React Native applications on Android. The metro-hermes-compiler is typically used in the build process of React Native applications to improve performance by precompiling JavaScript code.

What are metro-hermes-compiler's main functionalities?

Compile JavaScript to Hermes Bytecode

This feature allows you to compile JavaScript source code into Hermes bytecode. The compiled bytecode can then be executed by the Hermes engine, which can improve the performance of React Native applications.

const { compile } = require('metro-hermes-compiler');
const fs = require('fs');

const sourceCode = fs.readFileSync('input.js', 'utf8');
const bytecode = compile(sourceCode);
fs.writeFileSync('output.hbc', bytecode);

Source Map Generation

This feature allows you to generate source maps while compiling JavaScript to Hermes bytecode. Source maps are useful for debugging, as they map the compiled bytecode back to the original source code.

const { compile } = require('metro-hermes-compiler');
const fs = require('fs');

const sourceCode = fs.readFileSync('input.js', 'utf8');
const { bytecode, sourceMap } = compile(sourceCode, { sourceMap: true });
fs.writeFileSync('output.hbc', bytecode);
fs.writeFileSync('output.map', JSON.stringify(sourceMap));

Other packages similar to metro-hermes-compiler

FAQs

Package last updated on 22 Feb 2023

Did you know?

Socket

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.

Install

Related posts

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