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

metro-minify-obfuscator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-minify-obfuscator

🔐 Minifier for Metro based on javscript-obfuscator.

  • 1.0.1
  • latest
  • npm
  • Socket score

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

metro-minify-obfuscator

A metro minifier based on javascript-obfuscator for React Native

Installation

yarn add -D metro-minify-obfuscator

or

npm i --save-dev metro-minify-obfuscator

Usage

  • update metro.config.js on your project
module.exports = {
  transformer: {
    ...
    minifierPath: 'metro-minify-obfuscator', // <- add this
    minifierConfig: {
      defaultMinifierPath: require('metro-minify-uglify'), // required if filter/includeNodeModules options is set, can be metro-minify-uglify or metro-minify-terser dependes on RN version / available installed minifier
      filter: (filename) => true, // return true to obfuscate
      includeNodeModules: true, // set false to ignore node_modules from obfuscation
      trace: false, // show output log
      obfuscatorOptions: {
        // put additional javscript-obfuscator configuration here
      }
    },
  },
};
  • you can add additional obfuscation config to the minifierConfig properties (⚠️ NOT ALL OPTION IS GUARANTEED WORKING ON REACT-NATIVE, IT MIGHT BREAK YOUR APPS 🙈 )
  • run packager with --reset-cache argument to clear metro cache

Default Options

{
  "stringArray": false,
  "compact": true,
  "controlFlowFlattening": true,
  "controlFlowFlatteningThreshold": 0.75,
  "identifierNamesGenerator": "hexadecimal",
  "numbersToExpressions": true,
  "splitStrings": true,
  "splitStringsChunkLength": 3,
  "transformObjectKeys": true,
  "simplify": true,
  "disableConsoleOutput": true,
  "log": false,
  "selfDefending": true,
  "unicodeEscapeSequence": true
}

Comparison with other libraries

Release History

  • v1.0.x - Add additional option to filter / exclude node_modules file from obfuscation. ⚠️ upgrading to this version need update to your metro.config.js please be aware
// before
module.exports = {
  transformer: {
    ...
    minifierPath: 'metro-minify-obfuscator', // <- add this
    minifierConfig: {
      // put additional javscript-obfuscator configuration here
    },
  },
};

// after
module.exports = {
  transformer: {
    ...
    minifierPath: 'metro-minify-obfuscator', // <- add this
    minifierConfig: {
      defaultMinifierPath: require('metro-minify-uglify'), // required if filter/includeNodeModules options is set, can be metro-minify-uglify or metro-minify-terser dependes on RN version / available installed minifier
      filter: (filename) => true, // return true to obfuscate
      includeNodeModules: true, // set false to ignore node_modules from obfuscation
      trace: false, // show output log
      obfuscatorOptions: {
        // put additional javscript-obfuscator configuration here
      }
    },
  },
};
  • v0.x.x - Initial fork from metro-minify-uglify configured with JSO library

FAQs

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