Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ecmacomp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecmacomp

Compile javascript modules, optimize them with prepack and terser if `NODE_ENV` is `production`, and do more optimisations from this project. Reduce your code in production today!

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

ecmacomp Build Status

Compile javascript modules, optimize them with prepack and terser if NODE_ENV is production, and do more optimisations from this project. Reduce your code in production today!

Further optimizations are coming up:

  • Caching React elements in variables and modifying them before passing them to React.createElement
  • Turning fs.readFileSync and other sync APIs into their Promise counterparts, and turning every function above the call into an async function
  • Removing react completely using rawact
  • Reducing GC allocations
  • Caching some function results
  • ...And other amazing optimizations

Usage (CLI)

You can disable rollup or prepack (to disable terser, use the NODE_ENV environment variable NODE_ENV=production ecmacomp ...)

$ ecmacomp input.js [--norollup] [--noprepack] [--public dir] [--output file]

Usage (JS API)

await require('ecmacomp')({ filename: 'input.js' })  // Or 'function code....'

Hacking ecmacomp

To hack on ecmacomp, clone this repository (git clone https://github.com/fabiosantoscode/ecmacomp), cd to it, run npm i, write a test in the appropriate place, respect the lint (npm run lint) and start hacking :)

This CLI command reveals the bytecode for a piece of javascript:

$ ecmacomp --parse input.js

You can use this bytecode as reference because it's the bytecode used in all the optimisations.

FAQs

Package last updated on 23 Dec 2018

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