@udenbaguse/syamcode 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish-github-packages.yml +36 -0
- package/CHANGELOG.md +29 -0
- package/LICENSE +43 -0
- package/README.md +57 -0
- package/bin/syamcode-syamkey-v2.js +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-gpr:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read
|
|
26
|
+
packages: write
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: 20
|
|
32
|
+
registry-url: https://npm.pkg.github.com/
|
|
33
|
+
- run: npm ci
|
|
34
|
+
- run: npm publish
|
|
35
|
+
env:
|
|
36
|
+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Version 2.0.0 (2026-05-14)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Remove comments and unnecessary whitespace
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- Restore original identifier names from minified code using the .syamkey version 2.
|
|
10
|
+
- Scope-aware Babel AST transformations for safer renaming
|
|
11
|
+
|
|
12
|
+
## Version 1.0.0 (2026-05-13)
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `.syamkey` mapping file generation
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Reversible identifier obfuscation using SHA-256 (Syamkey version 2).
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- `restore` command to recover original identifiers
|
|
22
|
+
|
|
23
|
+
## Version 0.1.0 (2026-05-12)
|
|
24
|
+
Initial release with basic minification and obfuscation features
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
- CLI minifier for JS
|
|
28
|
+
- replace identifier names with Syamkey version 1 (generic id1, id2, etc).
|
|
29
|
+
- Restore original identifier names from minified code
|
package/LICENSE
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# END-USER LICENSE AGREEMENT (EULA)
|
|
2
|
+
|
|
3
|
+
## FOR "SYAMCODE" SOFTWARE
|
|
4
|
+
Version 2.0.0 - Date May 14, 2026
|
|
5
|
+
|
|
6
|
+
Created by: Muhamad Syamsudin (@udenbaguse)
|
|
7
|
+
Contact: udenbagusee@gmail.com
|
|
8
|
+
Official Site: https://www.npmjs.com/package/syamcode
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
### 1. LICENSE GRANT
|
|
13
|
+
a. We grant you a NON-EXCLUSIVE, NON-TRANSFERRABLE, and LIMITED right to use the SyamCode Software FREE OF CHARGE for personal OR commercial purposes, subject to the terms and conditions set forth below.
|
|
14
|
+
b. This license applies to all users who install or use the Software, without limitation on usage count, but remains subject to the terms of this Agreement.
|
|
15
|
+
|
|
16
|
+
### 2. MANDATORY USAGE REQUIREMENTS
|
|
17
|
+
You MUST comply with the following requirements when using the SyamCode Software:
|
|
18
|
+
a. *ATTRIBUTION REQUIRED* – On all projects, applications, or products that use SyamCode Software, you must provide attribution to the creator in the following format:
|
|
19
|
+
> "This software uses SyamCode by Muhamad Syamsudin (@udenbaguse) – https://www.npmjs.com/package/syamcode"
|
|
20
|
+
- Attribution must be displayed in the project documentation, application "About" page, or in the README.md file if the project is uploaded to GitHub.
|
|
21
|
+
b. *NO MODIFICATIONS* – You are NOT permitted to modify, decompile, or add new features to the Software without written consent from us.
|
|
22
|
+
c. *NO REDISTRIBUTION* – You are NOT permitted to sell, redistribute, or rent the Software to third parties. You may only provide a link to the official SyamCode page on npm or our site.
|
|
23
|
+
|
|
24
|
+
### 3. INTELLECTUAL PROPERTY RIGHTS
|
|
25
|
+
a. All copyrights, trademarks, and intellectual property rights related to the SyamCode Software are the EXCLUSIVE property of Muhamad Syamsudin.
|
|
26
|
+
b. This Software is NOT open source and cannot be shared or modified according to open source license standards.
|
|
27
|
+
c. You acquire no rights to the Software except the usage license mentioned in this Agreement.
|
|
28
|
+
|
|
29
|
+
### 4. NO WARRANTIES
|
|
30
|
+
a. The Software is provided "AS IS" without any warranties, either express or implied.
|
|
31
|
+
b. We do not guarantee that the Software will run without errors or meet your requirements.
|
|
32
|
+
|
|
33
|
+
### 5. LIMITATION OF LIABILITY
|
|
34
|
+
We shall not be liable for any damages (including financial loss, data loss, or business damage) caused by the use of or inability to use the Software.
|
|
35
|
+
|
|
36
|
+
### 6. EULA CHANGES
|
|
37
|
+
We reserve the right to change the contents of this EULA at any time. Changes will be notified through updates on npm or announcements on our official site.
|
|
38
|
+
|
|
39
|
+
### 7. APPLICABLE LAW
|
|
40
|
+
This Agreement is governed by the laws applicable worldwide.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
By installing or using the SyamCode Software, you agree to comply with all terms and conditions in this EULA.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# syamcode
|
|
2
|
+
|
|
3
|
+
CLI for **minify + reversible identifier obfuscation** that can be restored using a key file named `.syamkey`.
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
## License
|
|
8
|
+
|
|
9
|
+
This software is proprietary. By using SyamCode, you agree to the [End-User License Agreement (EULA)](LICENSE).
|
|
10
|
+
|
|
11
|
+
For selected code extensions (especially JS/TS), `syamcode`:
|
|
12
|
+
|
|
13
|
+
1. produces a minified version
|
|
14
|
+
2. replaces identifier names with hash SHA-256
|
|
15
|
+
3. writes a key file: `<outputPath>.syamkey` (JSON mapping)
|
|
16
|
+
4. can restore identifiers back to the original names using `syamcode restore`
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Minify (generates `.syamkey`)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx @udenbaguse/syamcode <inputPath> <outputPath>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Outputs:
|
|
27
|
+
|
|
28
|
+
- `<outputPath>`: minified code
|
|
29
|
+
- `<outputPath>.syamkey`: mapping for JS/TS/JSX/TSX
|
|
30
|
+
|
|
31
|
+
### Restore
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @udenbaguse/syamcode restore <minifiedPath> <syamkeyPath> <outputPath>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx @udenbaguse/syamcode src/app.js dist/app.min.js
|
|
41
|
+
npx @udenbaguse/syamcode dist/app.min.js dist/app.min.js.syamkey dist/app.restored.js
|
|
42
|
+
|
|
43
|
+
npx @udenbaguse/syamcode src/app.mjs dist/app.min.mjs
|
|
44
|
+
npx @udenbaguse/syamcode dist/app.min.mjs dist/app.min.mjs.syamkey dist/app.restored.mjs
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Supported extensions
|
|
48
|
+
|
|
49
|
+
- `.js` and `.mjs`:
|
|
50
|
+
- parse using **Babel AST**
|
|
51
|
+
- remove comments + compress whitespace
|
|
52
|
+
- generate `.syamkey` mapping: `originalIdentifier -> idN`
|
|
53
|
+
|
|
54
|
+
## Important notes
|
|
55
|
+
|
|
56
|
+
- Restore returns the **identifier names** (after reversing the rename), not the original whitespace/comments.
|
|
57
|
+
- For JS/TS/JSX/TSX, restoration correctness is improved by using **scope-aware** Babel AST transformations.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const h8c1f70202294=require("fs");const h2af3e4058a57=require("path");const h1e3dd9bf91ec=require("@babel/parser");const ha05db41bff92=require("@babel/traverse").default;const h49bb08ee733c=require("@babel/generator").default;function h89eb6ea55fa2(hd5376fb71f40){console.error(`[syamcode] ${hd5376fb71f40}`);process.exit(1);}function h7f9074d5576c(h6ae982cd6642){return h2af3e4058a57.extname(h6ae982cd6642).toLowerCase();}function h6351615c8a8f(h5dfb1953dba4){return[".js",".mjs"].includes(h5dfb1953dba4);}function h2f166f66d757(h82a359cd6c2a,hbdfc7e55fe5e){const h56c21e415fc0=["jsx","typescript","classProperties","classPrivateProperties","classPrivateMethods","decorators-legacy","dynamicImport","exportDefaultFrom","exportNamespaceFrom","importMeta","objectRestSpread","optionalChaining","nullishCoalescingOperator","topLevelAwait","logicalAssignment","numericSeparator"];return h1e3dd9bf91ec.parse(h82a359cd6c2a,{sourceType:"module",plugins:h56c21e415fc0});}function h4cb652516fe5(h71ed5fd24466){let h7b585ab22d82=h71ed5fd24466.replace(/\/\*[\s\S]*?\*\//g,"");h7b585ab22d82=h7b585ab22d82.replace(/[\t\r\n]+/g," ");h7b585ab22d82=h7b585ab22d82.replace(/\s{2,}/g," ");h7b585ab22d82=h7b585ab22d82.replace(/\s*([{}:;,])\s*/g,"$1");return h7b585ab22d82.trim();}function h2eeeeac9dd91(ha63ca81e262a){let hc83abc1950dc=ha63ca81e262a.replace(/<!--([\s\S]*?)-->/g,"");hc83abc1950dc=hc83abc1950dc.replace(/>\s+</g,"><");hc83abc1950dc=hc83abc1950dc.replace(/\s{2,}/g," ");return hc83abc1950dc.trim();}function hb8c4c44dfe4c(hac6730e4e83d){const h247942793499=JSON.parse(hac6730e4e83d);return JSON.stringify(h247942793499);}function h36e067163d82(hc87998de1a40){let h7b585ab22d82=hc87998de1a40.replace(/<!--([\s\S]*?)-->/g,"");h7b585ab22d82=h7b585ab22d82.replace(/[\t\r\n]+/g," ");h7b585ab22d82=h7b585ab22d82.replace(/\s{2,}/g," ");h7b585ab22d82=h7b585ab22d82.replace(/\s*([<>"'=;,:{}()])\s*/g,"$1");return h7b585ab22d82.trim();}function h979662ce8ee6(h32d9e9a274a2,h54d7c33a6c1e){const h5dfb1953dba4=h7f9074d5576c(h32d9e9a274a2);switch(h5dfb1953dba4){case".css":return h4cb652516fe5(h54d7c33a6c1e);case".html":case".htm":return h2eeeeac9dd91(h54d7c33a6c1e);case".json":return hb8c4c44dfe4c(h54d7c33a6c1e);case".svg":return h36e067163d82(h54d7c33a6c1e);default:return h54d7c33a6c1e.replace(/[\t\r\n]+/g," ").replace(/\s{2,}/g," ").trim();}}function hbd1fc26e32c7(h1055798b54f1,h765d94ef9a28){const h235cf8d123f9=h2f166f66d757(h1055798b54f1,h765d94ef9a28);const h8c98dac3c021=require("crypto");const hfbdd38b59c5e={};function h097447d9c842(he16ece5e50d5){const h4b2e2a3995cf=h8c98dac3c021.createHash("sha256").update(he16ece5e50d5,"utf8").digest("base64url");const hfc65974f3d50=Buffer.from(h4b2e2a3995cf,"base64url").toString("hex");return`h${hfc65974f3d50.slice(0,12)}`;}function h0a4ad87fa85b(h423df3064bc1){if(hfbdd38b59c5e[h423df3064bc1])return hfbdd38b59c5e[h423df3064bc1];const h2db1dfbaeaf2=h097447d9c842(h423df3064bc1);hfbdd38b59c5e[h423df3064bc1]=h2db1dfbaeaf2;return h2db1dfbaeaf2;}ha05db41bff92(h235cf8d123f9,{Program(h8555bea15467){},enter(h6965d5aeeae1){const hfe438832652d=h6965d5aeeae1.scope;if(!hfe438832652d)return;const hdf298a406795=hfe438832652d.bindings||{};for(const[h3b1a4166fefc,h0761138ae541]of Object.entries(hdf298a406795)){if(!h0761138ae541)continue;const h3f37d1ec469a=h0a4ad87fa85b(h3b1a4166fefc);if(h3f37d1ec469a===h3b1a4166fefc)continue;try{hfe438832652d.rename(h3b1a4166fefc,h3f37d1ec469a);}catch{}}}});const h148f0cf6f7f6=h49bb08ee733c(h235cf8d123f9,{jsescOption:{minimal:true},compact:true,comments:false}).code;return{obfuscated:h148f0cf6f7f6,mapping:hfbdd38b59c5e};}function hf874c4061104(h7e1d0f31fec8,h128cbc4889c6,h6c37c1c6564d){if(!h128cbc4889c6||h128cbc4889c6.format!=="syamcode-key-v2"||!h128cbc4889c6.mapping){h89eb6ea55fa2("Invalid .syamkey format. Expected syamcode-key-v2.");}const h94cabf61dd67={};for(const[h297249893dd3,hddfbfe0e9e13]of Object.entries(h128cbc4889c6.mapping)){h94cabf61dd67[hddfbfe0e9e13]=h297249893dd3;}const h9cf2df1ff37d=h2f166f66d757(h7e1d0f31fec8,h6c37c1c6564d||h128cbc4889c6.sourceExt||".js");ha05db41bff92(h9cf2df1ff37d,{enter(h6965d5aeeae1){const hfe438832652d=h6965d5aeeae1.scope;if(!hfe438832652d)return;const hdf298a406795=hfe438832652d.bindings||{};for(const[h3b1a4166fefc,h0761138ae541]of Object.entries(hdf298a406795)){if(!h0761138ae541)continue;if(!h94cabf61dd67[h3b1a4166fefc])continue;const h0d9222391467=h94cabf61dd67[h3b1a4166fefc];if(h0d9222391467===h3b1a4166fefc)continue;try{hfe438832652d.rename(h3b1a4166fefc,h0d9222391467);}catch{}}}});const h8a1e40b61004=h49bb08ee733c(h9cf2df1ff37d,{jsescOption:{minimal:true},compact:true,comments:false}).code;return h8a1e40b61004;}function h3abe54adc461(h8193260ed24b,h5158afe85882){if(!h8c1f70202294.existsSync(h8193260ed24b))h89eb6ea55fa2(`Input path not found: ${h8193260ed24b}`);const h818a87c4c690=h8c1f70202294.statSync(h8193260ed24b);if(!h818a87c4c690.isFile())h89eb6ea55fa2("Input must be a file path (bukan folder).");const h82862f7a7d34=h8c1f70202294.readFileSync(h8193260ed24b,"utf8");const hc79628f90524=h7f9074d5576c(h8193260ed24b);if(!h6351615c8a8f(hc79628f90524)){h89eb6ea55fa2(`Unsupported file extension: "${hc79628f90524}". syamcode only supports ".js" and ".mjs".`);}const hc38ece0f6ef5=`${h5158afe85882}.syamkey`;const{obfuscated:h2984f2f20c67,mapping:hee5dfbdec661}=hbd1fc26e32c7(h82862f7a7d34,hc79628f90524);let hc4b0b96e7bec={format:"syamcode-key-v2",version:2,sourceExt:hc79628f90524,mapping:hee5dfbdec661,createdAt:new Date().toISOString()};h8c1f70202294.mkdirSync(h2af3e4058a57.dirname(h5158afe85882),{recursive:true});h8c1f70202294.writeFileSync(h5158afe85882,h2984f2f20c67,"utf8");h8c1f70202294.writeFileSync(hc38ece0f6ef5,JSON.stringify(hc4b0b96e7bec,null,0),"utf8");console.log(`[syamcode] Minified: ${h8193260ed24b} -> ${h5158afe85882}`);console.log(`[syamcode] Key: ${h5158afe85882}.syamkey -> generated`);}function h52e3adbc0740(h6e4acaaad5ca,h337d8b4c92e1,heb8b168c2a9b){if(!h8c1f70202294.existsSync(h6e4acaaad5ca))h89eb6ea55fa2(`Minified file not found: ${h6e4acaaad5ca}`);if(!h8c1f70202294.existsSync(h337d8b4c92e1))h89eb6ea55fa2(`Syamkey file not found: ${h337d8b4c92e1}`);const h4a98f8014b8e=h8c1f70202294.readFileSync(h6e4acaaad5ca,"utf8");const h44e7f4cf1ee6=h8c1f70202294.readFileSync(h337d8b4c92e1,"utf8");let h478e4c28c4e1;try{h478e4c28c4e1=JSON.parse(h44e7f4cf1ee6);}catch{h89eb6ea55fa2("Failed to parse syamkey JSON.");}const ha8293b62ed49=h7f9074d5576c(h6e4acaaad5ca);const h52dae8141294=hf874c4061104(h4a98f8014b8e,h478e4c28c4e1,ha8293b62ed49);h8c1f70202294.mkdirSync(h2af3e4058a57.dirname(heb8b168c2a9b),{recursive:true});h8c1f70202294.writeFileSync(heb8b168c2a9b,h52dae8141294,"utf8");console.log(`[syamcode] Restored identifiers: ${h6e4acaaad5ca} -> ${heb8b168c2a9b}`);}function hcf55a35275cc(){const h7dd50880859f=process.argv.slice(2);if(h7dd50880859f.length>=1&&h7dd50880859f[0]==="restore"){if(h7dd50880859f.length<4){h89eb6ea55fa2("Invalid arguments. Usage: npx syamcode restore <minifiedPath> <syamkeyPath> <outputPath>");}h52e3adbc0740(h7dd50880859f[1],h7dd50880859f[2],h7dd50880859f[3]);return;}if(h7dd50880859f.length<2){h89eb6ea55fa2("Invalid arguments. Usage: npx syamcode <inputPath> <outputPath>");}h3abe54adc461(h7dd50880859f[0],h7dd50880859f[1]);}hcf55a35275cc();
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@udenbaguse/syamcode",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "CLI to minify code and perform reversible identifier obfuscation + restore (Babel AST).",
|
|
5
|
+
"bin": {
|
|
6
|
+
"syamcode": "bin/syamcode-syamkey-v2.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "commonjs",
|
|
9
|
+
"license": "PROPRIETARY",
|
|
10
|
+
"author": "Muhamad Syamsudin (@udenbaguse)",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@babel/generator": "^7.26.0",
|
|
13
|
+
"@babel/parser": "^7.26.0",
|
|
14
|
+
"@babel/traverse": "^7.26.0"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"syamcode",
|
|
18
|
+
"minify",
|
|
19
|
+
"unminify",
|
|
20
|
+
"encrypt",
|
|
21
|
+
"decrypt",
|
|
22
|
+
"code-minify",
|
|
23
|
+
"code-restore",
|
|
24
|
+
"javascript",
|
|
25
|
+
"babel",
|
|
26
|
+
"code-tool",
|
|
27
|
+
"developer-tools",
|
|
28
|
+
"udenbaguse"
|
|
29
|
+
]
|
|
30
|
+
}
|