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

incinerator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

incinerator

Incinerate unused code!

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Incinerator

Incinerator of Reg

A PoC implementation of unused code elimination in runtime

What's this?

It's a proof-of-concept implementation of unused code elemenation, which means Incinerator checks if a part of code is actually used in runtime and removes it if unused. For the time being, only function blocks are checked.

Install

npm install incinerator

How to use

Please run incinerator with actual runtime environment, for example, webpack --watch.

incinerator src/

Demo

The following is a link to the demo of an example with Chart.js, where bundle size is reduced from ~400K to ~80K.

Youtube: Incinerator Demo

Before incineration

before

After incineration

after

How Incinerator works

I recommend reading the code, as it's only ~200 lines long.

  1. Tag every function with a unique ID
  2. Check if a function is called in runtime via WebSocket
  3. When finished, empty uncalled functions
  4. Remove unused top-level variables to remove unused dependencies

Please also consider playing with an example.

License

ISC

FAQs

Package last updated on 28 Jul 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