npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sakum-compiler

v1.0.3

Published

Advanced JavaScript obfuscator combining Google Closure Compiler and JavaScript-Obfuscator with RC4 encryption, Base64 encoding, and batch processing support

Readme

sakum-enc - JavaScript Obfuscator & Compiler

JavaScript obfuscator yang menggabungkan Google Closure Compiler dan JavaScript-Obfuscator untuk minify dan enkripsi kode JavaScript dengan mudah. Sekarang dengan auto-detection untuk React, Next.js, TypeScript, dan JSX!

🚀 Fitur

  • Compile - Minify dengan Google Closure Compiler
  • RC4 Encryption - Enkripsi dengan RC4 + obfuscation
  • Base64 Encoding - Enkripsi dengan Base64
  • Full Mode - Compile + RC4 (hasil terbaik)
  • Light Mode - Obfuscation cepat
  • Batch Processing - Process multiple files sekaligus
  • Watch Mode - Auto-recompile saat file berubah
  • Dry-run - Preview hasil tanpa save
  • Detailed Report - Laporan file size & reduction
  • Config File - Support .sakumrc.json
  • 3 Obfuscation Profiles - Light, Medium, Heavy
  • 🆕 Auto-Detection - Deteksi JSX, TypeScript, React, Next.js otomatis
  • 🆕 Smart Fallback - Otomatis pilih mode yang compatible
  • 🆕 React/Next.js Support - Aman untuk JSX dan TypeScript files

📦 Instalasi

npm install -g sakum-compiler

Atau lokal:

npm install --save-dev sakum-compiler
npx sakum-enc <file.js>

🎯 Usage

Basic Usage

# Default mode (full)
sakum-enc input.js

# Dengan mode spesifik
sakum-enc input.js --mode rc4
sakum-enc input.js --mode base64
sakum-enc input.js --mode compile
sakum-enc input.js --mode light

Dengan Output File

sakum-enc input.js --mode full -o output.js
sakum-enc input.js -m rc4 -o dist/app.js

Batch Processing

# Multiple files
sakum-enc input1.js input2.js input3.js --mode light

# Dengan glob pattern
sakum-enc src/**/*.js --mode full

Watch Mode

# Auto-recompile saat file berubah
sakum-enc app.js --watch --mode full

# Shorthand
sakum-enc app.js -w -m full

Dry-run Mode

# Preview hasil tanpa save
sakum-enc input.js --dry-run
sakum-enc input.js --mode full --dry-run

Custom Profile

# Light profile - cepat, encryption minimal
sakum-enc input.js --profile light

# Medium profile - balanced
sakum-enc input.js --profile medium

# Heavy profile - maximum protection
sakum-enc input.js --profile heavy

Tanpa Report

sakum-enc input.js --no-report

💻 Command Options

| Option | Shorthand | Deskripsi | |--------|-----------|-----------| | --mode <mode> | -m | Mode: compile, rc4, base64, full, light (default: full) | | --output <file> | -o | Output file path | | --watch | -w | Watch mode - auto-recompile | | --dry-run | - | Preview tanpa save | | --no-report | - | Sembunyikan report | | --profile <name> | -p | Profile: light, medium, heavy | | --help | -h | Show help | | --version | -v | Show version |

📋 Available Modes

1. compile

Minify dengan Google Closure Compiler. Mengurangi ukuran file tanpa enkripsi.

sakum-enc app.js --mode compile

Hasil: app.min.js

2. rc4

Obfuscate dengan RC4 encryption. Kode akan di-scramble dan di-encrypt dengan RC4.

sakum-enc app.js --mode rc4

Hasil: app.rc4.js

3. base64

Obfuscate dengan Base64 encoding. Lebih cepat tapi enkripsi lebih lemah dari RC4.

sakum-enc app.js --mode base64

Hasil: app.b64.js

4. full (Default)

Kombinasi compile + RC4. Ukuran minimal + security maksimal - REKOMENDASI.

sakum-enc app.js --mode full

Hasil: app.min.rc4.js

Contoh hasil:

  • Input: 50 KB
  • Output: 8 KB
  • Reduction: 84%

5. light

Obfuscation ringan tanpa compile. Paling cepat untuk development.

sakum-enc app.js --mode light

Hasil: app.obs.js

🔍 Auto-Detection & Smart Fallback

Sakum-enc otomatis mendeteksi file type Anda dan memilih mode yang paling compatible:

Apa yang Dideteksi?

  • 📱 React/JSX - Deteksi file .jsx dan React imports
  • 📘 TypeScript - Deteksi .ts, .tsx, dan TypeScript syntax
  • Next.js - Deteksi Next.js specific imports dan exports
  • 🚀 Vanilla JavaScript - Pure .js files

Contoh Auto-Detection

# React component - automatically safe untuk JSX
sakum-enc components/Button.jsx
# Auto-suggests: rc4 mode (tidak pakai Closure Compiler)

# TypeScript file - automatically safe untuk TS
sakum-enc utils/helpers.ts
# Auto-suggests: rc4 mode (skip compile step)

# Vanilla JavaScript - safe untuk Closure Compiler
sakum-enc utils.js
# Auto-suggests: full mode (compile + RC4)

# Next.js page
sakum-enc pages/api/users.js
# Auto-suggests: rc4 mode (stay safe)

Output Log Contoh

📦 Processing: src/components/Button.jsx
   Type: React + JSX
   ⚠️  Mode 'compile' mungkin tidak compatible. Disarankan: 'rc4' (use --force untuk override)
   → Switching to: rc4
   Mode: rc4 | Profile: medium

Disable Auto-Detection

# Gunakan mode yang dipilih tanpa auto-suggest
sakum-enc app.jsx --mode compile --no-auto-detect

# Force mode even if not recommended
sakum-enc app.jsx --mode full --force

🎨 Obfuscation Profiles

Light Profile

{
  "compact": true,
  "controlFlowFlattening": false,
  "stringArray": false
}
  • ⚡ Tercepat
  • 🔓 Paling mudah di-deobfuscate
  • 💾 File size minimal
  • Cocok untuk: Development, testing

Medium Profile (Default)

{
  "compact": true,
  "controlFlowFlattening": true,
  "stringArray": true,
  "stringArrayEncoding": ["base64"],
  "deadCodeInjection": true
}
  • ⚖️ Balanced
  • 🔒 Protection sedang
  • 💾 File size normal
  • Cocok untuk: Production, medium security

Heavy Profile

{
  "compact": true,
  "controlFlowFlattening": true,
  "stringArray": true,
  "stringArrayEncoding": ["rc4"],
  "selfDefending": true,
  "deadCodeInjection": true,
  "unicodeEscapeSequence": true
}
  • 🔐 Maximum protection
  • 🐢 Sedikit lebih lambat
  • 💾 File size lebih besar
  • Cocok untuk: Sensitive code, high security

📄 Config File (.sakumrc.json)

Buat .sakumrc.json di project root untuk custom default config:

{
  "defaultMode": "full",
  "profile": "medium",
  "autoBuild": false
}

Config Options:

  • defaultMode - Default mode jika tidak spesifik (default: "full")
  • profile - Default profile (default: "medium")
  • autoBuild - Experimental feature

📊 Contoh Penggunaan

Development Setup

# Watch mode dengan light profile (cepat)
sakum-enc src/app.js -w --mode light -p light

Production Build

# Compile + RC4 dengan heavy profile
sakum-enc src/app.js --mode full -p heavy -o dist/app.min.js

Batch Build

# Build semua files dengan full mode
sakum-enc src/**/*.js --mode full

NPM Scripts

Tambahkan ke package.json:

{
  "scripts": {
    "build": "sakum-enc src/app.js --mode full -o dist/app.js",
    "dev": "sakum-enc src/app.js --watch --mode light",
    "prod": "sakum-enc src/app.js --mode full -p heavy -o dist/app.min.js"
  }
}

Kemudian jalankan:

npm run build
npm run dev
npm run prod

⚛️ React & Next.js Support

Sakum-enc sekarang fully compatible dengan React, Next.js, dan TypeScript projects!

React/JSX Files

# Obfuscate React component
sakum-enc src/components/Button.jsx
# Output: src/components/Button.rc4.jsx (safe untuk JSX)

# Watch mode untuk development
sakum-enc src/App.jsx --watch --mode light

# Batch process semua components
sakum-enc src/components/**/*.jsx --mode rc4

Hasil: Components tetap functional, tapi code-nya di-obfuscate.

Next.js Pages & API Routes

# API routes
sakum-enc pages/api/users.js --mode rc4

# Page components
sakum-enc pages/dashboard.tsx --mode rc4 --profile medium

# Multiple pages
sakum-enc pages/**/*.{js,jsx,ts,tsx} --mode light

TypeScript Files

# TypeScript compilation + obfuscation
sakum-enc utils/helpers.ts --mode ts-compile

# Or simple obfuscation (recommended)
sakum-enc utils/helpers.ts --mode rc4

# Watch mode untuk development
sakum-enc src/**/*.ts --watch --mode light

Full Next.js Build Script

{
  "scripts": {
    "build": "next build && sakum-enc .next/static/chunks/**/*.js --mode rc4",
    "dev": "next dev",
    "obfuscate": "sakum-enc pages/**/*.{js,jsx,ts,tsx} --mode light --watch",
    "prod": "next build && sakum-enc pages/**/*.{js,jsx,ts,tsx} --mode rc4 -p heavy"
  }
}

Create React App (CRA) Setup

# Build dengan CRA
npm run build

# Obfuscate bundle files
sakum-enc build/static/js/**/*.js --mode rc4 -p heavy

# Atau dengan auto-watch
sakum-enc src/**/*.jsx --watch --mode light

⚠️ Penting untuk React/Next.js

  1. Auto-Detection Aktif - Sakum sudah otomatis detect JSX/TS
  2. Mode Compatibility - Jangan pakai compile mode untuk JSX files
  3. Safe by Default - Jika type terdeteksi, akan auto-fallback ke safe mode
  4. Test Setelah Obfuscation - Selalu test aplikasi setelah obfuscation
# Preview tanpa save
sakum-enc src/App.jsx --dry-run

# Force jika yakin
sakum-enc src/App.jsx --mode compile --force

🔍 Hasil Contoh

Mode Comparison

Original: 45.2 KB

compile:    11.3 KB  (74.9% reduction)
rc4:        24.1 KB  (46.6% reduction)
base64:     25.8 KB  (42.9% reduction)
full:       13.2 KB  (70.8% reduction)
light:      28.5 KB  (36.9% reduction)

⚠️ Catatan Penting

  1. Backup original file - Selalu simpan original code
  2. Test hasil - Pastikan obfuscated code berfungsi dengan baik
  3. Java required - Pastikan Java ter-install untuk mode compile
  4. Performance - Heavy obfuscation sedikit menambah startup time
  5. Deobfuscation - Tidak ada enkripsi yang 100% aman, hanya membuat reverse engineering lebih sulit

🐛 Troubleshooting

Error: "java: command not found"

# Install Java
# Ubuntu/Debian
sudo apt-get install openjdk-11-jre

# macOS
brew install java

# Windows
# Download dari: https://www.java.com/

Error: "compiler.jar tidak ditemukan"

Pastikan lib/compiler.jar ada di folder package. Download dari:

wget https://github.com/SakumDisiniPa/SakumDisiniPa/raw/main/compiler/compiler.jar -O lib/compiler.jar

File tidak berubah

Pastikan file path benar:

sakum-enc ./src/app.js  # Gunakan path relative
sakum-enc /home/user/project/src/app.js  # Atau absolute path

Q: Error "Unexpected token <" atau syntax error untuk JSX

A: File detectnya JSX tapi masih di-compile dengan Closure Compiler?

# Disable auto-detect dan pakai rc4 mode
sakum-enc App.jsx --mode rc4 --no-auto-detect

# Atau gunakan --force untuk auto-detect
sakum-enc App.jsx  # Harus auto-suggest rc4 mode

Q: React component error setelah obfuscation

A: Obfuscation berhasil tapi React error saat runtime?

# Test dengan dry-run dulu
sakum-enc App.jsx --dry-run

# Atau pakai light profile dulu
sakum-enc App.jsx --mode light -p light

# Cek console untuk error details
npm run dev  # atau npm start

Q: Next.js getStaticProps error

A: Next.js special functions bisa confuse obfuscator:

# Untuk files tanpa obfuscation, skip saja
sakum-enc pages/api/*.js  # Hanya API routes
# pages/index.js akan di-skip otomatis jika detect Next.js

# Atau pakai light profile
sakum-enc pages/*.js --mode light -p light

Q: TypeScript compilation error

A: TS files tidak bisa di-compile dengan Closure Compiler:

# Gunakan ts-compile mode (menggunakan Terser)
sakum-enc utils.ts --mode ts-compile

# Atau pakai rc4 (skip compile)
sakum-enc utils.ts --mode rc4

# Auto-detect akan suggest mode yang tepat
sakum-enc utils.ts  # Auto-suggests rc4

Q: Obfuscated React file jadi besar

A: Obfuscation menambah code size. Minimalisir dengan compile dulu:

# Untuk vanilla JS:
sakum-enc utils.js --mode full  # Compile + obfuscate

# Untuk React components, gunakan light:
sakum-enc App.jsx --mode light -p light

# Atau hanya RC4 tanpa light profile:
sakum-enc App.jsx --mode rc4 -p light

Tips: Gunakan --dry-run untuk preview hasil sebelum save! 🚀

📝 License

This project is licensed under the GNU General Public License version 2 (GPLv2). See the LICENSE file for details.