afterpack 0.0.9 → 0.0.10

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/dist/cli.js CHANGED
@@ -1,88 +1,46 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync, statSync } from "node:fs";
3
- import { basename, extname, relative, resolve } from "node:path";
4
- import { processFile, version } from "@afterpack/core";
2
+ import { version } from "@afterpack/core";
5
3
 
6
4
  //#region src/cli.ts
7
5
  const args = process.argv.slice(2);
8
- function showBanner() {
6
+ if (args.includes("--version") || args.includes("-v")) {
7
+ console.log(`AfterPack v${version()}`);
8
+ process.exit(0);
9
+ }
10
+ if (args[0] === "audit") {
9
11
  console.log(`
10
12
  ╔═══════════════════════════════════════════════════════╗
11
13
  ║ AfterPack v${version().padEnd(42)}║
12
- ║ High-performance JavaScript obfuscator ║
13
14
  ╚═══════════════════════════════════════════════════════╝
14
- `);
15
- }
16
- function showHelp() {
17
- showBanner();
18
- console.log(`
19
- Usage:
20
- npx afterpack <file.js> Process a JavaScript file
21
- npx afterpack --version Show version
22
- npx afterpack --help Show this help
23
15
 
24
- Options:
25
- -h, --help Show this help message
26
- -v, --version Show version number
16
+ Audit command coming soon!
27
17
 
28
- Examples:
29
- npx afterpack dist/app.js
30
- npx afterpack build/index.mjs
18
+ This will analyze your site and reveal what AI can
19
+ extract from your client-side JavaScript.
31
20
 
32
- Learn more: https://afterpack.dev
21
+ ┌─────────────────────────────────────────────────────┐
22
+ │ Join the waitlist to get notified: │
23
+ │ https://www.afterpack.dev │
24
+ └─────────────────────────────────────────────────────┘
33
25
  `);
34
- }
35
- if (args.includes("--version") || args.includes("-v")) {
36
- console.log(`AfterPack v${version()}`);
37
26
  process.exit(0);
38
27
  }
39
- if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
40
- showHelp();
41
- process.exit(0);
42
- }
43
- const files = args.filter((arg) => !arg.startsWith("-"));
44
- if (files.length === 0) {
45
- console.error("Error: No file specified");
46
- console.error("Run 'npx afterpack --help' for usage information");
47
- process.exit(1);
48
- }
49
- showBanner();
50
- let hasErrors = false;
51
- for (const file of files) {
52
- const filePath = resolve(file);
53
- const relativePath = relative(process.cwd(), filePath);
54
- if (!existsSync(filePath)) {
55
- console.error(`Error: File not found: ${relativePath}`);
56
- hasErrors = true;
57
- continue;
58
- }
59
- if (statSync(filePath).isDirectory()) {
60
- console.error(`Error: Expected a file, got directory: ${relativePath}`);
61
- console.error(" Hint: Directory processing coming soon!");
62
- hasErrors = true;
63
- continue;
64
- }
65
- const ext = extname(filePath).toLowerCase();
66
- if (ext !== ".js" && ext !== ".mjs" && ext !== ".cjs") {
67
- console.error(`Error: Expected JavaScript file (.js, .mjs, .cjs), got: ${basename(filePath)}`);
68
- hasErrors = true;
69
- continue;
70
- }
71
- try {
72
- console.log(`Processing: ${relativePath}`);
73
- processFile(filePath);
74
- console.log(` Done!`);
75
- } catch (err) {
76
- const message = err instanceof Error ? err.message : String(err);
77
- console.error(`Error processing ${relativePath}: ${message}`);
78
- hasErrors = true;
79
- }
80
- }
81
- console.log("");
82
- if (hasErrors) {
83
- console.log("Completed with errors.");
84
- process.exit(1);
85
- } else console.log("All files processed successfully.");
28
+ console.log(`
29
+ ╔═══════════════════════════════════════════════════════╗
30
+ ║ AfterPack v${version().padEnd(42)}║
31
+ ╚═══════════════════════════════════════════════════════╝
32
+
33
+ Coming soon: High-performance JavaScript protection.
34
+
35
+ Secure your client-side logic from AI extraction,
36
+ reverse engineering, vulnerability scanning, and
37
+ automated scraping.
38
+
39
+ ┌─────────────────────────────────────────────────────┐
40
+ │ Join the waitlist for early access: │
41
+ │ https://www.afterpack.dev │
42
+ └─────────────────────────────────────────────────────┘
43
+ `);
86
44
 
87
45
  //#endregion
88
46
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, statSync } from \"node:fs\";\nimport { resolve, relative, extname, basename } from \"node:path\";\n\n// Import the native addon\n// @ts-expect-error - Types will be available after @afterpack/core is published\nimport { processFile, version } from \"@afterpack/core\";\n\nconst args = process.argv.slice(2);\n\n// Banner\nfunction showBanner(): void {\n console.log(`\n ╔═══════════════════════════════════════════════════════╗\n ║ AfterPack v${version().padEnd(42)}║\n ║ High-performance JavaScript obfuscator ║\n ╚═══════════════════════════════════════════════════════╝\n`);\n}\n\n// Help text\nfunction showHelp(): void {\n showBanner();\n console.log(`\nUsage:\n npx afterpack <file.js> Process a JavaScript file\n npx afterpack --version Show version\n npx afterpack --help Show this help\n\nOptions:\n -h, --help Show this help message\n -v, --version Show version number\n\nExamples:\n npx afterpack dist/app.js\n npx afterpack build/index.mjs\n\nLearn more: https://afterpack.dev\n`);\n}\n\n// Version\nif (args.includes(\"--version\") || args.includes(\"-v\")) {\n console.log(`AfterPack v${version()}`);\n process.exit(0);\n}\n\n// Help or no args\nif (args.length === 0 || args.includes(\"--help\") || args.includes(\"-h\")) {\n showHelp();\n process.exit(0);\n}\n\n// Filter out flags\nconst files = args.filter((arg) => !arg.startsWith(\"-\"));\n\nif (files.length === 0) {\n console.error(\"Error: No file specified\");\n console.error(\"Run 'npx afterpack --help' for usage information\");\n process.exit(1);\n}\n\n// Process each file\nshowBanner();\n\nlet hasErrors = false;\n\nfor (const file of files) {\n const filePath = resolve(file);\n const relativePath = relative(process.cwd(), filePath);\n\n // Check file exists\n if (!existsSync(filePath)) {\n console.error(`Error: File not found: ${relativePath}`);\n hasErrors = true;\n continue;\n }\n\n // Check it's a file, not a directory\n if (statSync(filePath).isDirectory()) {\n console.error(`Error: Expected a file, got directory: ${relativePath}`);\n console.error(\" Hint: Directory processing coming soon!\");\n hasErrors = true;\n continue;\n }\n\n // Check extension\n const ext = extname(filePath).toLowerCase();\n if (ext !== \".js\" && ext !== \".mjs\" && ext !== \".cjs\") {\n console.error(\n `Error: Expected JavaScript file (.js, .mjs, .cjs), got: ${basename(filePath)}`\n );\n hasErrors = true;\n continue;\n }\n\n // Process the file\n try {\n console.log(`Processing: ${relativePath}`);\n processFile(filePath);\n console.log(` Done!`);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.error(`Error processing ${relativePath}: ${message}`);\n hasErrors = true;\n }\n}\n\n// Summary\nconsole.log(\"\");\nif (hasErrors) {\n console.log(\"Completed with errors.\");\n process.exit(1);\n} else {\n console.log(\"All files processed successfully.\");\n}\n"],"mappings":";;;;;;AASA,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAGlC,SAAS,aAAmB;AAC1B,SAAQ,KAAK;;kBAEG,SAAS,CAAC,OAAO,GAAG,CAAC;;;EAGrC;AACD;AAGD,SAAS,WAAiB;AACxB,aAAY;AACZ,SAAQ,KAAK;;;;;;;;;;;;;;;EAeb;AACD;AAGD,IAAI,KAAK,SAAS,YAAY,IAAI,KAAK,SAAS,KAAK,EAAE;AACrD,SAAQ,KAAK,aAAa,SAAS,CAAC,EAAE;AACtC,SAAQ,KAAK,EAAE;AAChB;AAGD,IAAI,KAAK,WAAW,KAAK,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,KAAK,EAAE;AACvE,WAAU;AACV,SAAQ,KAAK,EAAE;AAChB;AAGD,MAAM,QAAQ,KAAK,OAAO,CAAC,SAAS,IAAI,WAAW,IAAI,CAAC;AAExD,IAAI,MAAM,WAAW,GAAG;AACtB,SAAQ,MAAM,2BAA2B;AACzC,SAAQ,MAAM,mDAAmD;AACjE,SAAQ,KAAK,EAAE;AAChB;AAGD,YAAY;AAEZ,IAAI,YAAY;AAEhB,KAAK,MAAM,QAAQ,OAAO;CACxB,MAAM,WAAW,QAAQ,KAAK;CAC9B,MAAM,eAAe,SAAS,QAAQ,KAAK,EAAE,SAAS;AAGtD,MAAK,WAAW,SAAS,EAAE;AACzB,UAAQ,OAAO,yBAAyB,aAAa,EAAE;AACvD,cAAY;AACZ;CACD;AAGD,KAAI,SAAS,SAAS,CAAC,aAAa,EAAE;AACpC,UAAQ,OAAO,yCAAyC,aAAa,EAAE;AACvE,UAAQ,MAAM,4CAA4C;AAC1D,cAAY;AACZ;CACD;CAGD,MAAM,MAAM,QAAQ,SAAS,CAAC,aAAa;AAC3C,KAAI,QAAQ,SAAS,QAAQ,UAAU,QAAQ,QAAQ;AACrD,UAAQ,OACL,0DAA0D,SAAS,SAAS,CAAC,EAC/E;AACD,cAAY;AACZ;CACD;AAGD,KAAI;AACF,UAAQ,KAAK,cAAc,aAAa,EAAE;AAC1C,cAAY,SAAS;AACrB,UAAQ,KAAK,SAAS;CACvB,SAAQ,KAAK;EACZ,MAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;AAChE,UAAQ,OAAO,mBAAmB,aAAa,IAAI,QAAQ,EAAE;AAC7D,cAAY;CACb;AACF;AAGD,QAAQ,IAAI,GAAG;AACf,IAAI,WAAW;AACb,SAAQ,IAAI,yBAAyB;AACrC,SAAQ,KAAK,EAAE;AAChB,MACC,SAAQ,IAAI,oCAAoC"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { version } from \"@afterpack/core\";\n\nconst args = process.argv.slice(2);\n\n// Version flag\nif (args.includes(\"--version\") || args.includes(\"-v\")) {\n console.log(`AfterPack v${version()}`);\n process.exit(0);\n}\n\n// Audit command\nif (args[0] === \"audit\") {\n console.log(`\n ╔═══════════════════════════════════════════════════════╗\n ║ AfterPack v${version().padEnd(42)}║\n ╚═══════════════════════════════════════════════════════╝\n\n Audit command coming soon!\n\n This will analyze your site and reveal what AI can\n extract from your client-side JavaScript.\n\n ┌─────────────────────────────────────────────────────┐\n │ Join the waitlist to get notified: │\n │ https://www.afterpack.dev │\n └─────────────────────────────────────────────────────┘\n`);\n process.exit(0);\n}\n\n// Default: show main waitlist message\nconsole.log(`\n ╔═══════════════════════════════════════════════════════╗\n ║ AfterPack v${version().padEnd(42)}║\n ╚═══════════════════════════════════════════════════════╝\n\n Coming soon: High-performance JavaScript protection.\n\n Secure your client-side logic from AI extraction,\n reverse engineering, vulnerability scanning, and\n automated scraping.\n\n ┌─────────────────────────────────────────────────────┐\n │ Join the waitlist for early access: │\n │ https://www.afterpack.dev │\n └─────────────────────────────────────────────────────┘\n`);\n"],"mappings":";;;;AAIA,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAGlC,IAAI,KAAK,SAAS,YAAY,IAAI,KAAK,SAAS,KAAK,EAAE;AACrD,SAAQ,KAAK,aAAa,SAAS,CAAC,EAAE;AACtC,SAAQ,KAAK,EAAE;AAChB;AAGD,IAAI,KAAK,OAAO,SAAS;AACvB,SAAQ,KAAK;;kBAEG,SAAS,CAAC,OAAO,GAAG,CAAC;;;;;;;;;;;;EAYrC;AACA,SAAQ,KAAK,EAAE;AAChB;AAGD,QAAQ,KAAK;;kBAEK,SAAS,CAAC,OAAO,GAAG,CAAC;;;;;;;;;;;;;EAarC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afterpack",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "A high-performance post-build JavaScript obfuscator and minifier",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -42,6 +42,7 @@
42
42
  "@afterpack/core": "^0.0.9"
43
43
  },
44
44
  "devDependencies": {
45
+ "@types/node": "^25.0.9",
45
46
  "tsdown": "^0.11.0",
46
47
  "typescript": "^5.0.0",
47
48
  "vitest": "^2.0.0"