expose-kit 0.0.1 → 0.1.1

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/index.js ADDED
@@ -0,0 +1,230 @@
1
+ #!/usr/bin/env node
2
+
3
+ // index.ts
4
+ import { Command } from "commander";
5
+ import { dirname } from "path";
6
+ import { fileURLToPath } from "url";
7
+ import chalk4 from "chalk";
8
+
9
+ // utils/cli/createCommand.ts
10
+ var createCommand = (creator) => {
11
+ return (program2) => {
12
+ creator(program2);
13
+ };
14
+ };
15
+
16
+ // commands/parsable/index.ts
17
+ import { readFileSync } from "fs";
18
+ import { parse } from "@babel/parser";
19
+ import loading from "loading-cli";
20
+
21
+ // utils/common/sleep.ts
22
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
23
+
24
+ // utils/common/createPrompt.ts
25
+ import chalk from "chalk";
26
+ var PREFIX = chalk.bold(chalk.gray("?"));
27
+ var createPrompt = (...args) => {
28
+ const question = args.shift();
29
+ if (!question) {
30
+ throw new Error("Question is required");
31
+ }
32
+ const defaultAnswer = args.shift();
33
+ const answer = defaultAnswer ? prompt(`${PREFIX} ${question}`, defaultAnswer) : prompt(`${PREFIX} ${question}`);
34
+ return answer;
35
+ };
36
+
37
+ // utils/babel/createParseOptions.ts
38
+ var createParseOptions = (filename) => {
39
+ const isTypeScript = filename.endsWith(".ts") || filename.endsWith(".tsx");
40
+ return {
41
+ sourceType: "module",
42
+ allowAwaitOutsideFunction: true,
43
+ plugins: isTypeScript ? ["typescript", "jsx"] : ["jsx"]
44
+ };
45
+ };
46
+
47
+ // utils/common/timeout.ts
48
+ var timeout = (fn, ms) => {
49
+ let aborted = false;
50
+ const { resolve, reject, promise } = Promise.withResolvers();
51
+ const timer = setTimeout(() => {
52
+ aborted = true;
53
+ reject(new Error("Hang detected, please report to the developer"));
54
+ }, ms);
55
+ const finish = () => {
56
+ clearTimeout(timer);
57
+ resolve();
58
+ };
59
+ fn({
60
+ finish,
61
+ aborted: () => aborted
62
+ });
63
+ return promise;
64
+ };
65
+
66
+ // utils/common/showError.ts
67
+ import chalk2 from "chalk";
68
+ var showError = (message) => {
69
+ console.error(`${chalk2.red("\u2716")} ${message}`);
70
+ };
71
+
72
+ // commands/parsable/index.ts
73
+ var parsable_default = createCommand((program2) => {
74
+ program2.command("parsable").description("Check if the file is parsable").argument("[file]", "The file to check").option("--file <file>", "The file to check").action(async (fileArgument, options) => {
75
+ await timeout(async ({ finish }) => {
76
+ const filename = fileArgument ?? options.file ?? createPrompt("Enter the file path:");
77
+ if (!filename) {
78
+ showError("No file provided");
79
+ return finish();
80
+ }
81
+ try {
82
+ const fileContent = readFileSync(filename, "utf8");
83
+ const loader = loading("Checking if the file is parsable...").start();
84
+ try {
85
+ parse(fileContent, createParseOptions(filename));
86
+ await sleep(500);
87
+ loader.succeed("File is parsable");
88
+ return finish();
89
+ } catch (error) {
90
+ loader.fail("File is not parsable");
91
+ showError(
92
+ `Error parsing file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
93
+ );
94
+ return finish();
95
+ }
96
+ } catch (error) {
97
+ showError(
98
+ `Error reading file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
99
+ );
100
+ return finish();
101
+ }
102
+ }, 30 * 1e3);
103
+ });
104
+ });
105
+
106
+ // utils/cli/showCredit.ts
107
+ import chalk3 from "chalk";
108
+ var beautify = (strings, ...values) => {
109
+ let result = "";
110
+ for (let i = 0; i < strings.length; i++) {
111
+ result += strings[i];
112
+ if (i < values.length) {
113
+ result += values[i];
114
+ }
115
+ }
116
+ result = result.replace(/^\s*\n/, "").replace(/\n\s*$/, "");
117
+ return result;
118
+ };
119
+ var isNoColor = () => {
120
+ return process.env.NO_COLOR !== void 0 && process.argv.includes("--no-color");
121
+ };
122
+ var calmGradienrain = (text) => {
123
+ if (isNoColor()) {
124
+ return text;
125
+ }
126
+ const startHue = 210;
127
+ const endHue = 300;
128
+ const saturation = 0.45;
129
+ const value = 0.8;
130
+ const ease = (t) => t * t * (3 - 2 * t);
131
+ return text.split("").map((char, i) => {
132
+ const t = ease(i / Math.max(text.length - 1, 1));
133
+ const hue = startHue + (endHue - startHue) * t;
134
+ const c = value * saturation;
135
+ const h = hue / 60;
136
+ const x = c * (1 - Math.abs(h % 2 - 1));
137
+ const m = value - c;
138
+ let r = 0, g = 0, b = 0;
139
+ if (h < 1) [r, g, b] = [c, x, 0];
140
+ else if (h < 2) [r, g, b] = [x, c, 0];
141
+ else if (h < 3) [r, g, b] = [0, c, x];
142
+ else if (h < 4) [r, g, b] = [0, x, c];
143
+ else if (h < 5) [r, g, b] = [x, 0, c];
144
+ else [r, g, b] = [c, 0, x];
145
+ return chalk3.rgb(
146
+ Math.round((r + m) * 255),
147
+ Math.round((g + m) * 255),
148
+ Math.round((b + m) * 255)
149
+ )(char);
150
+ }).join("");
151
+ };
152
+ var showCredit = (VERSION) => beautify`
153
+ ${calmGradienrain(`Expose Kit v${VERSION}`)}
154
+ `;
155
+
156
+ // package.json
157
+ var package_default = {
158
+ name: "expose-kit",
159
+ version: "0.0.1",
160
+ module: "dist/index.js",
161
+ type: "module",
162
+ private: false,
163
+ author: "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
164
+ license: "MIT",
165
+ repository: {
166
+ type: "git",
167
+ url: "git+https://github.com/EdamAme-x/expose-kit.git"
168
+ },
169
+ publishConfig: {
170
+ registry: "https://registry.npmjs.org",
171
+ access: "public"
172
+ },
173
+ homepage: "https://evex.land",
174
+ scripts: {
175
+ format: "biome format **/*.ts",
176
+ "format:fix": "biome format --write **/*.ts",
177
+ lint: "biome lint **/*.ts",
178
+ "lint:fix": "biome lint --write **/*.ts",
179
+ build: "tsup",
180
+ postbuild: "publint",
181
+ release: "np"
182
+ },
183
+ devDependencies: {
184
+ "@biomejs/biome": "2.3.11",
185
+ "@types/bun": "latest",
186
+ np: "^10.2.0",
187
+ publint: "^0.3.16",
188
+ tsup: "^8.5.1"
189
+ },
190
+ peerDependencies: {
191
+ typescript: "^5"
192
+ },
193
+ dependencies: {
194
+ "@babel/generator": "^7.28.5",
195
+ "@babel/parser": "^7.28.5",
196
+ "@babel/traverse": "^7.28.5",
197
+ "@babel/types": "^7.28.5",
198
+ "@types/babel__generator": "^7.27.0",
199
+ "@types/babel__traverse": "^7.28.0",
200
+ chalk: "^5.6.2",
201
+ commander: "^14.0.2",
202
+ "loading-cli": "^1.1.2"
203
+ },
204
+ bin: {
205
+ expose: "dist/index.js",
206
+ "expose-kit": "dist/index.js",
207
+ "expose-js": "dist/index.js",
208
+ exposejs: "dist/index.js"
209
+ },
210
+ files: [
211
+ "dist"
212
+ ]
213
+ };
214
+
215
+ // index.ts
216
+ var __filename = fileURLToPath(import.meta.url);
217
+ var __dirname = dirname(__filename);
218
+ console.log(showCredit(package_default.version));
219
+ console.log();
220
+ var program = new Command();
221
+ program.name("expose").description("CLI for Deobfuscating").version(
222
+ chalk4.bold("It's written above, lol"),
223
+ "-v, --version",
224
+ "display version number"
225
+ );
226
+ var commands = [parsable_default];
227
+ for (const command of commands) {
228
+ command(program);
229
+ }
230
+ program.parse();
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "expose-kit",
3
- "version": "0.0.1",
4
- "module": "index.ts",
3
+ "version": "0.1.1",
5
4
  "type": "module",
6
5
  "private": false,
7
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
@@ -16,14 +15,21 @@
16
15
  },
17
16
  "homepage": "https://evex.land",
18
17
  "scripts": {
18
+ "test": "bun test",
19
19
  "format": "biome format **/*.ts",
20
20
  "format:fix": "biome format --write **/*.ts",
21
21
  "lint": "biome lint **/*.ts",
22
- "lint:fix": "biome lint --write **/*.ts"
22
+ "lint:fix": "biome lint --write **/*.ts",
23
+ "build": "tsup && cp package.json dist/package.json",
24
+ "postbuild": "publint",
25
+ "release": "np"
23
26
  },
24
27
  "devDependencies": {
25
28
  "@biomejs/biome": "2.3.11",
26
- "@types/bun": "latest"
29
+ "@types/bun": "latest",
30
+ "cp": "^0.2.0",
31
+ "publint": "^0.3.16",
32
+ "tsup": "^8.5.1"
27
33
  },
28
34
  "peerDependencies": {
29
35
  "typescript": "^5"
@@ -44,5 +50,8 @@
44
50
  "expose-kit": "dist/index.js",
45
51
  "expose-js": "dist/index.js",
46
52
  "exposejs": "dist/index.js"
47
- }
53
+ },
54
+ "files": [
55
+ "dist"
56
+ ]
48
57
  }
package/biome.jsonc DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
3
- "vcs": {
4
- "enabled": true,
5
- "clientKind": "git",
6
- "useIgnoreFile": true
7
- },
8
- "files": {
9
- "ignoreUnknown": false
10
- },
11
- "formatter": {
12
- "enabled": true,
13
- "indentStyle": "tab"
14
- },
15
- "linter": {
16
- "enabled": true,
17
- "rules": {
18
- "recommended": true
19
- }
20
- },
21
- "javascript": {
22
- "formatter": {
23
- "quoteStyle": "double"
24
- }
25
- },
26
- "assist": {
27
- "enabled": true,
28
- "actions": {
29
- "source": {
30
- "organizeImports": "on"
31
- }
32
- }
33
- }
34
- }
@@ -1,58 +0,0 @@
1
- import { createCommand } from "@/utils/cli/createCommand";
2
- import { readFileSync } from "node:fs";
3
- import { parse } from "@babel/parser";
4
- import loading from "loading-cli";
5
- import { sleep } from "@/utils/common/sleep";
6
- import { createPrompt } from "@/utils/common/createPrompt";
7
- import { createParseOptions } from "@/utils/babel/createParseOptions";
8
- import { timeout } from "@/utils/common/timeout";
9
- import { showError } from "@/utils/common/showError";
10
-
11
- export default createCommand((program) => {
12
- program
13
- .command("parsable")
14
- .description("Check if the file is parsable")
15
- .argument("[file]", "The file to check")
16
- .option("--file <file>", "The file to check")
17
- .action(async (fileArgument, options: { file?: string }) => {
18
- await timeout(async ({ finish }) => {
19
- const filename =
20
- fileArgument ?? options.file ?? createPrompt("Enter the file path:");
21
-
22
- if (!filename) {
23
- showError("No file provided");
24
- return finish();
25
- }
26
-
27
- try {
28
- const fileContent = readFileSync(filename, "utf8");
29
- const loader = loading("Checking if the file is parsable...").start();
30
-
31
- try {
32
- parse(fileContent, createParseOptions(filename));
33
-
34
- // Patch memory
35
- await sleep(500);
36
- loader.succeed("File is parsable");
37
-
38
- return finish();
39
- } catch (error: unknown) {
40
- loader.fail("File is not parsable");
41
- showError(
42
- `Error parsing file '${filename}': ${
43
- error instanceof Error ? error.message : "Unknown error"
44
- }`
45
- );
46
- return finish();
47
- }
48
- } catch (error: unknown) {
49
- showError(
50
- `Error reading file '${filename}': ${
51
- error instanceof Error ? error.message : "Unknown error"
52
- }`
53
- );
54
- return finish();
55
- }
56
- }, 30 * 1000);
57
- });
58
- });
package/index.ts DELETED
@@ -1,33 +0,0 @@
1
- import { Command } from "commander";
2
- import { dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import chalk from "chalk";
5
- import parsable from "@/commands/parsable";
6
- import { showCredit } from "@/utils/cli/showCredit";
7
- import pkg from "./package.json" with { type: "json" };
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = dirname(__filename);
11
-
12
- // Read version from package.json
13
- console.log(showCredit(pkg.version));
14
- console.log();
15
-
16
- const program = new Command();
17
-
18
- program
19
- .name("expose")
20
- .description("CLI for Deobfuscating")
21
- .version(
22
- chalk.bold("It's written above, lol"),
23
- "-v, --version",
24
- "display version number",
25
- );
26
-
27
- const commands = [parsable];
28
-
29
- for (const command of commands) {
30
- command(program);
31
- }
32
-
33
- program.parse();
package/tsconfig.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // Environment setup & latest features
4
- "lib": ["ESNext"],
5
- "target": "ESNext",
6
- "module": "ESNext",
7
- "moduleDetection": "force",
8
- "jsx": "react-jsx",
9
- "allowJs": true,
10
-
11
- // Bundler mode
12
- "moduleResolution": "bundler",
13
- "allowImportingTsExtensions": true,
14
- "verbatimModuleSyntax": true,
15
- "noEmit": true,
16
-
17
- // Best practices
18
- "strict": true,
19
- "skipLibCheck": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "noUncheckedIndexedAccess": true,
22
-
23
- // Some stricter flags (disabled by default)
24
- "noUnusedLocals": false,
25
- "noUnusedParameters": false,
26
- "noPropertyAccessFromIndexSignature": false,
27
- "paths": {
28
- "@/*": ["./*"]
29
- }
30
- }
31
- }
@@ -1,11 +0,0 @@
1
- import type { ParserOptions } from "@babel/parser";
2
-
3
- export const createParseOptions = (filename: string) => {
4
- const isTypeScript = filename.endsWith(".ts") || filename.endsWith(".tsx");
5
-
6
- return {
7
- sourceType: "module",
8
- allowAwaitOutsideFunction: true,
9
- plugins: isTypeScript ? ["typescript", "jsx"] : ["jsx"],
10
- } as ParserOptions;
11
- };
@@ -1,7 +0,0 @@
1
- import type { Command } from "commander";
2
-
3
- export const createCommand = (creator: (program: Command) => void) => {
4
- return (program: Command) => {
5
- creator(program);
6
- };
7
- };
@@ -1,67 +0,0 @@
1
- import chalk from "chalk";
2
-
3
- // `\naaa\n` => `aaa`
4
- const beautify = <T>(strings: TemplateStringsArray, ...values: T[]) => {
5
- let result = "";
6
- for (let i = 0; i < strings.length; i++) {
7
- result += strings[i];
8
- if (i < values.length) {
9
- result += values[i];
10
- }
11
- }
12
- result = result.replace(/^\s*\n/, "").replace(/\n\s*$/, "");
13
- return result;
14
- };
15
-
16
- const isNoColor = () => {
17
- return (
18
- process.env.NO_COLOR !== undefined && process.argv.includes("--no-color")
19
- );
20
- };
21
-
22
- const calmGradienrain = (text: string) => {
23
- if (isNoColor()) {
24
- return text;
25
- }
26
-
27
- const startHue = 210;
28
- const endHue = 300;
29
- const saturation = 0.45;
30
- const value = 0.8;
31
-
32
- const ease = (t: number) => t * t * (3 - 2 * t);
33
-
34
- return text
35
- .split("")
36
- .map((char, i) => {
37
- const t = ease(i / Math.max(text.length - 1, 1));
38
- const hue = startHue + (endHue - startHue) * t;
39
-
40
- const c = value * saturation;
41
- const h = hue / 60;
42
- const x = c * (1 - Math.abs((h % 2) - 1));
43
- const m = value - c;
44
-
45
- let r = 0,
46
- g = 0,
47
- b = 0;
48
-
49
- if (h < 1) [r, g, b] = [c, x, 0];
50
- else if (h < 2) [r, g, b] = [x, c, 0];
51
- else if (h < 3) [r, g, b] = [0, c, x];
52
- else if (h < 4) [r, g, b] = [0, x, c];
53
- else if (h < 5) [r, g, b] = [x, 0, c];
54
- else [r, g, b] = [c, 0, x];
55
-
56
- return chalk.rgb(
57
- Math.round((r + m) * 255),
58
- Math.round((g + m) * 255),
59
- Math.round((b + m) * 255),
60
- )(char);
61
- })
62
- .join("");
63
- };
64
-
65
- export const showCredit = (VERSION: string) => beautify`
66
- ${calmGradienrain(`Expose Kit v${VERSION}`)}
67
- `;
@@ -1,13 +0,0 @@
1
- import chalk from "chalk";
2
-
3
- const PREFIX = chalk.bold(chalk.gray("?"));
4
-
5
- export const createPrompt = (...args: Parameters<typeof prompt>) => {
6
- const question = args.shift();
7
- if (!question) {
8
- throw new Error("Question is required");
9
- }
10
- const defaultAnswer = args.shift();
11
- const answer = defaultAnswer ? prompt(`${PREFIX} ${question}`, defaultAnswer) : prompt(`${PREFIX} ${question}`);
12
- return answer;
13
- };
@@ -1,5 +0,0 @@
1
- import chalk from "chalk";
2
-
3
- export const showError = (message: string) => {
4
- console.error(`${chalk.red("✖")} ${message}`);
5
- };
@@ -1,2 +0,0 @@
1
- export const sleep = (ms: number) =>
2
- new Promise((resolve) => setTimeout(resolve, ms));
@@ -1,24 +0,0 @@
1
- export const timeout = (
2
- fn: (ctx: { finish: () => void; aborted: () => boolean }) => void | Promise<void>,
3
- ms: number
4
- ) => {
5
- let aborted = false;
6
- const { resolve, reject, promise } = Promise.withResolvers<void>();
7
-
8
- const timer = setTimeout(() => {
9
- aborted = true;
10
- reject(new Error("Hang detected, please report to the developer"));
11
- }, ms);
12
-
13
- const finish = () => {
14
- clearTimeout(timer);
15
- resolve();
16
- };
17
-
18
- fn({
19
- finish,
20
- aborted: () => aborted,
21
- });
22
-
23
- return promise;
24
- };