expose-kit 0.12.0 → 0.13.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/README.md CHANGED
@@ -358,6 +358,46 @@ Notes:
358
358
 
359
359
  ---
360
360
 
361
+ ### `expose remove-anti-tamper`
362
+
363
+ Drop the self-defending wrapper, debug guards, and console hijacks generated by anti-tamper scripts.
364
+ ```js
365
+ var wrapper = (function () {
366
+ var guard = true;
367
+ return function (ctx, fn) {
368
+ var thunk = guard ? function () {
369
+ if (fn) {
370
+ fn.apply(ctx, arguments);
371
+ fn = null;
372
+ }
373
+ } : function () {};
374
+ guard = false;
375
+ return thunk;
376
+ };
377
+ })();
378
+
379
+ wrapper(this, function () {
380
+ console.log("tamper");
381
+ });
382
+
383
+ console.log("safe");
384
+ ```
385
+ Example is [here](https://github.com/evex-dev/expose-kit/tree/main/commands/remove-anti-tamper/mocks).
386
+
387
+ ```bash
388
+ expose remove-anti-tamper path/to/file.js --output path/to/file.remove-anti-tamper.js
389
+ ```
390
+
391
+ Args:
392
+ - `--o, --output <file>`
393
+ Output file path
394
+
395
+ Notes:
396
+ - Targets wrappers that return guarded helper functions and removes their invocations.
397
+ - Cleans up debug/console helper functions before removing the wrapper.
398
+
399
+ ---
400
+
361
401
  ### `expose control-flow-packer`
362
402
 
363
403
  Inline control-flow flattening loops generated by string-based state machines.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // index.ts
4
4
  import { Command } from "commander";
5
- import { dirname as dirname13, join as join13 } from "path";
5
+ import { dirname as dirname14, join as join14 } from "path";
6
6
  import { fileURLToPath } from "url";
7
7
  import chalk4 from "chalk";
8
8
 
@@ -1941,9 +1941,9 @@ var remove_deadcode_default = createCommand((program3) => {
1941
1941
  );
1942
1942
  });
1943
1943
 
1944
- // commands/control-flow-packer/index.ts
1945
- import { readFileSync as readFileSync11, writeFileSync as writeFileSync10 } from "fs";
1944
+ // commands/remove-anti-tamper/index.ts
1946
1945
  import { basename as basename10, dirname as dirname10, extname as extname10, join as join10 } from "path";
1946
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync10 } from "fs";
1947
1947
  import { parse as parse11 } from "@babel/parser";
1948
1948
  import traverse10 from "@babel/traverse";
1949
1949
  import generate10 from "@babel/generator";
@@ -1953,22 +1953,200 @@ var walk2 = patchDefault(traverse10);
1953
1953
  var createDefaultOutputPath10 = (inputPath) => {
1954
1954
  const ext = extname10(inputPath);
1955
1955
  if (!ext) {
1956
- return `${inputPath}.control-flow-packer.js`;
1956
+ return `${inputPath}.remove-anti-tamper.js`;
1957
1957
  }
1958
1958
  const base = basename10(inputPath, ext);
1959
- return join10(dirname10(inputPath), `${base}.control-flow-packer${ext}`);
1959
+ return join10(dirname10(inputPath), `${base}.remove-anti-tamper${ext}`);
1960
+ };
1961
+ var isWrapperDeclaration = (node) => {
1962
+ if (!t9.isIdentifier(node.id)) return false;
1963
+ if (!node.init || !t9.isCallExpression(node.init)) return false;
1964
+ const callee = node.init.callee;
1965
+ if (!t9.isFunctionExpression(callee)) return false;
1966
+ if (callee.params.length !== 0) return false;
1967
+ const bodyStatements = callee.body.body;
1968
+ if (bodyStatements.length < 2) return false;
1969
+ const firstStatement = bodyStatements[0];
1970
+ if (!t9.isVariableDeclaration(firstStatement) || firstStatement.declarations.length !== 1) {
1971
+ return false;
1972
+ }
1973
+ const firstDecl = firstStatement.declarations[0];
1974
+ if (!t9.isIdentifier(firstDecl.id) || !t9.isBooleanLiteral(firstDecl.init, { value: true })) {
1975
+ return false;
1976
+ }
1977
+ const returnStatement = bodyStatements.find(
1978
+ (stmt) => t9.isReturnStatement(stmt)
1979
+ );
1980
+ if (!returnStatement || !t9.isFunctionExpression(returnStatement.argument)) {
1981
+ return false;
1982
+ }
1983
+ const innerFunction = returnStatement.argument;
1984
+ if (innerFunction.params.length < 2) {
1985
+ return false;
1986
+ }
1987
+ return true;
1988
+ };
1989
+ var removeReferencedFunctions = (callPath) => {
1990
+ const args = callPath.get("arguments");
1991
+ if (!args || args.length < 2) {
1992
+ return false;
1993
+ }
1994
+ const handler = args[1];
1995
+ if (!handler.isFunction()) {
1996
+ return false;
1997
+ }
1998
+ let removed = false;
1999
+ handler.traverse({
2000
+ CallExpression(innerPath) {
2001
+ const callee = innerPath.get("callee");
2002
+ if (!callee.isIdentifier()) return;
2003
+ const binding = callee.scope.getBinding(callee.node.name);
2004
+ if (!binding) return;
2005
+ const bindingPath = binding.path;
2006
+ if (bindingPath.isFunctionDeclaration() && !bindingPath.removed) {
2007
+ bindingPath.remove();
2008
+ removed = true;
2009
+ }
2010
+ }
2011
+ });
2012
+ return removed;
2013
+ };
2014
+ var cleanEmptyVariableDeclaration = (path) => {
2015
+ if (path.node.declarations.length === 0) {
2016
+ path.remove();
2017
+ }
2018
+ };
2019
+ var removeAntiTamperPatterns = (code, filename) => {
2020
+ const ast = parse11(code, createParseOptions(filename));
2021
+ let changed = false;
2022
+ walk2(ast, {
2023
+ VariableDeclarator(path) {
2024
+ if (!isWrapperDeclaration(path.node)) return;
2025
+ const wrapperName = path.node.id;
2026
+ if (!t9.isIdentifier(wrapperName)) return;
2027
+ const binding = path.scope.getBinding(wrapperName.name);
2028
+ if (!binding) return;
2029
+ let removedReference = false;
2030
+ const references = [...binding.referencePaths];
2031
+ for (const reference of references) {
2032
+ const callPath = reference.parentPath;
2033
+ if (!callPath?.isCallExpression()) continue;
2034
+ const removedDebug = removeReferencedFunctions(callPath);
2035
+ if (removedDebug) {
2036
+ changed = true;
2037
+ }
2038
+ const declaratorPath = callPath.findParent(
2039
+ (p) => p.isVariableDeclarator()
2040
+ );
2041
+ if (declaratorPath && declaratorPath.isVariableDeclarator()) {
2042
+ const parentDecl = declaratorPath.parentPath;
2043
+ declaratorPath.remove();
2044
+ if (parentDecl?.isVariableDeclaration()) {
2045
+ cleanEmptyVariableDeclaration(parentDecl);
2046
+ }
2047
+ removedReference = true;
2048
+ changed = true;
2049
+ continue;
2050
+ }
2051
+ const statement = callPath.getStatementParent();
2052
+ if (statement) {
2053
+ statement.remove();
2054
+ removedReference = true;
2055
+ changed = true;
2056
+ }
2057
+ }
2058
+ if (removedReference && !path.removed) {
2059
+ path.remove();
2060
+ changed = true;
2061
+ const parentDecl = path.parentPath;
2062
+ if (parentDecl?.isVariableDeclaration()) {
2063
+ cleanEmptyVariableDeclaration(parentDecl);
2064
+ }
2065
+ }
2066
+ }
2067
+ });
2068
+ return {
2069
+ code: patchDefault(generate10)(ast).code,
2070
+ changed
2071
+ };
2072
+ };
2073
+ var remove_anti_tamper_default = createCommand((program3) => {
2074
+ program3.command("remove-anti-tamper").description("Drop anti-tamper wrapper calls and helpers").argument("[file]", "The file to transform").option("--input, --file <file>", "The file to transform").option("--o, --output <file>", "Output file path").option("--unlimited", "Unlimited timeout").action(
2075
+ async (fileArgument, options) => {
2076
+ await timeout(
2077
+ async ({ finish }) => {
2078
+ const filename = fileArgument ?? options.file ?? await createPrompt("Enter the file path:");
2079
+ if (!filename) {
2080
+ showError("No file provided");
2081
+ return finish();
2082
+ }
2083
+ try {
2084
+ const fileContent = readFileSync11(filename, "utf8");
2085
+ const defaultOutputPath = createDefaultOutputPath10(filename);
2086
+ let outputPath = options.output;
2087
+ if (!outputPath) {
2088
+ const promptPath = (await createPrompt("Enter the output file path:"))?.trim();
2089
+ outputPath = promptPath || defaultOutputPath;
2090
+ }
2091
+ const loader = loading11("Removing anti-tamper patterns...").start();
2092
+ try {
2093
+ const { code: output, changed } = removeAntiTamperPatterns(
2094
+ fileContent,
2095
+ filename
2096
+ );
2097
+ writeFileSync10(outputPath, output, "utf8");
2098
+ loader.succeed(
2099
+ `Saved remove-anti-tamper file to: ${outputPath} (${diff(fileContent, output).length} lines changed${changed ? ", removed anti-tamper code" : ""})`
2100
+ );
2101
+ return finish();
2102
+ } catch (error) {
2103
+ loader.fail("Failed to apply remove-anti-tamper transform");
2104
+ showError(
2105
+ `Error transforming file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
2106
+ );
2107
+ return finish();
2108
+ }
2109
+ } catch (error) {
2110
+ showError(
2111
+ `Error reading file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
2112
+ );
2113
+ return finish();
2114
+ }
2115
+ },
2116
+ options.unlimited ? null : 120 * 1e3
2117
+ );
2118
+ }
2119
+ );
2120
+ });
2121
+
2122
+ // commands/control-flow-packer/index.ts
2123
+ import { readFileSync as readFileSync12, writeFileSync as writeFileSync11 } from "fs";
2124
+ import { basename as basename11, dirname as dirname11, extname as extname11, join as join11 } from "path";
2125
+ import { parse as parse12 } from "@babel/parser";
2126
+ import traverse11 from "@babel/traverse";
2127
+ import generate11 from "@babel/generator";
2128
+ import * as t10 from "@babel/types";
2129
+ import loading12 from "loading-cli";
2130
+ var walk3 = patchDefault(traverse11);
2131
+ var createDefaultOutputPath11 = (inputPath) => {
2132
+ const ext = extname11(inputPath);
2133
+ if (!ext) {
2134
+ return `${inputPath}.control-flow-packer.js`;
2135
+ }
2136
+ const base = basename11(inputPath, ext);
2137
+ return join11(dirname11(inputPath), `${base}.control-flow-packer${ext}`);
1960
2138
  };
1961
2139
  var isDeclarationOrAssignmentExpression = (node) => {
1962
- if (t9.isAssignmentExpression(node)) {
1963
- return t9.isIdentifier(node.left) && t9.isNumericLiteral(node.right);
2140
+ if (t10.isAssignmentExpression(node)) {
2141
+ return t10.isIdentifier(node.left) && t10.isNumericLiteral(node.right);
1964
2142
  }
1965
- if (t9.isVariableDeclaration(node) && node.declarations.length === 1 && t9.isIdentifier(node.declarations[0].id) && node.declarations[0].init && t9.isNumericLiteral(node.declarations[0].init)) {
2143
+ if (t10.isVariableDeclaration(node) && node.declarations.length === 1 && t10.isIdentifier(node.declarations[0].id) && node.declarations[0].init && t10.isNumericLiteral(node.declarations[0].init)) {
1966
2144
  return true;
1967
2145
  }
1968
2146
  return false;
1969
2147
  };
1970
2148
  var extractCounterInfo = (node) => {
1971
- if (t9.isAssignmentExpression(node)) {
2149
+ if (t10.isAssignmentExpression(node)) {
1972
2150
  return {
1973
2151
  counterName: node.left.name,
1974
2152
  initialValue: node.right.value
@@ -1981,22 +2159,22 @@ var extractCounterInfo = (node) => {
1981
2159
  };
1982
2160
  };
1983
2161
  var isStateArrayExpression = (node) => {
1984
- return t9.isCallExpression(node) && t9.isMemberExpression(node.callee) && t9.isStringLiteral(node.callee.object) && (t9.isStringLiteral(node.callee.property) && node.callee.property.value === "split" || t9.isIdentifier(node.callee.property) && node.callee.property.name === "split") && node.arguments.length === 1 && t9.isStringLiteral(node.arguments[0]);
2162
+ return t10.isCallExpression(node) && t10.isMemberExpression(node.callee) && t10.isStringLiteral(node.callee.object) && (t10.isStringLiteral(node.callee.property) && node.callee.property.value === "split" || t10.isIdentifier(node.callee.property) && node.callee.property.name === "split") && node.arguments.length === 1 && t10.isStringLiteral(node.arguments[0]);
1985
2163
  };
1986
2164
  var isFlatteningLoopBody = (node, statesName, counterName) => {
1987
- return t9.isBlockStatement(node) && node.body.length === 2 && t9.isBreakStatement(node.body[1]) && t9.isSwitchStatement(node.body[0]) && t9.isMemberExpression(node.body[0].discriminant) && t9.isIdentifier(node.body[0].discriminant.object) && node.body[0].discriminant.object.name === statesName && t9.isUpdateExpression(node.body[0].discriminant.property) && t9.isIdentifier(node.body[0].discriminant.property.argument) && node.body[0].discriminant.property.argument.name === counterName && node.body[0].cases.every(
1988
- (c) => c.test && t9.isStringLiteral(c.test)
2165
+ return t10.isBlockStatement(node) && node.body.length === 2 && t10.isBreakStatement(node.body[1]) && t10.isSwitchStatement(node.body[0]) && t10.isMemberExpression(node.body[0].discriminant) && t10.isIdentifier(node.body[0].discriminant.object) && node.body[0].discriminant.object.name === statesName && t10.isUpdateExpression(node.body[0].discriminant.property) && t10.isIdentifier(node.body[0].discriminant.property.argument) && node.body[0].discriminant.property.argument.name === counterName && node.body[0].cases.every(
2166
+ (c) => c.test && t10.isStringLiteral(c.test)
1989
2167
  );
1990
2168
  };
1991
2169
  var isFlatteningForLoop = (node, statesName) => {
1992
- return t9.isForStatement(node) && node.init !== null && isDeclarationOrAssignmentExpression(node.init) && isFlatteningLoopBody(
2170
+ return t10.isForStatement(node) && node.init !== null && isDeclarationOrAssignmentExpression(node.init) && isFlatteningLoopBody(
1993
2171
  node.body,
1994
2172
  statesName,
1995
- t9.isAssignmentExpression(node.init) ? node.init.left.name : node.init.declarations[0].id.name
2173
+ t10.isAssignmentExpression(node.init) ? node.init.left.name : node.init.declarations[0].id.name
1996
2174
  );
1997
2175
  };
1998
2176
  var isFlatteningWhileLoop = (node, statesName, counterName) => {
1999
- return t9.isWhileStatement(node) && t9.isBooleanLiteral(node.test) && node.test.value === true && isFlatteningLoopBody(node.body, statesName, counterName);
2177
+ return t10.isWhileStatement(node) && t10.isBooleanLiteral(node.test) && node.test.value === true && isFlatteningLoopBody(node.body, statesName, counterName);
2000
2178
  };
2001
2179
  var getStates = (expression) => {
2002
2180
  const delimiter = expression.arguments[0].value;
@@ -2014,24 +2192,24 @@ var collectStatements = (cases, states, initialValue) => {
2014
2192
  }
2015
2193
  const blockStatements = casesMap.get(state);
2016
2194
  for (const statement of blockStatements) {
2017
- if (t9.isContinueStatement(statement)) {
2195
+ if (t10.isContinueStatement(statement)) {
2018
2196
  continue;
2019
2197
  }
2020
- statements.push(t9.cloneNode(statement, true));
2198
+ statements.push(t10.cloneNode(statement, true));
2021
2199
  }
2022
2200
  const lastStatement = blockStatements[blockStatements.length - 1];
2023
- if (lastStatement && t9.isReturnStatement(lastStatement)) {
2201
+ if (lastStatement && t10.isReturnStatement(lastStatement)) {
2024
2202
  break;
2025
2203
  }
2026
2204
  }
2027
2205
  return statements;
2028
2206
  };
2029
2207
  var packControlFlow = (code, filename) => {
2030
- const ast = parse11(code, createParseOptions(filename));
2208
+ const ast = parse12(code, createParseOptions(filename));
2031
2209
  let changedCount = 0;
2032
- walk2(ast, {
2210
+ walk3(ast, {
2033
2211
  VariableDeclarator(path) {
2034
- if (!path.node.init || !t9.isIdentifier(path.node.id)) {
2212
+ if (!path.node.init || !t10.isIdentifier(path.node.id)) {
2035
2213
  return;
2036
2214
  }
2037
2215
  if (!isStateArrayExpression(path.node.init)) {
@@ -2099,7 +2277,7 @@ var packControlFlow = (code, filename) => {
2099
2277
  }
2100
2278
  });
2101
2279
  return {
2102
- code: patchDefault(generate10)(ast).code,
2280
+ code: patchDefault(generate11)(ast).code,
2103
2281
  changedCount
2104
2282
  };
2105
2283
  };
@@ -2114,20 +2292,20 @@ var control_flow_packer_default = createCommand((program3) => {
2114
2292
  return finish();
2115
2293
  }
2116
2294
  try {
2117
- const fileContent = readFileSync11(filename, "utf8");
2118
- const defaultOutputPath = createDefaultOutputPath10(filename);
2295
+ const fileContent = readFileSync12(filename, "utf8");
2296
+ const defaultOutputPath = createDefaultOutputPath11(filename);
2119
2297
  let outputPath = options.output;
2120
2298
  if (!outputPath) {
2121
2299
  const promptPath = (await createPrompt("Enter the output file path:"))?.trim();
2122
2300
  outputPath = promptPath || defaultOutputPath;
2123
2301
  }
2124
- const loader = loading11("Packing control flow...").start();
2302
+ const loader = loading12("Packing control flow...").start();
2125
2303
  try {
2126
2304
  const { code: output, changedCount } = packControlFlow(
2127
2305
  fileContent,
2128
2306
  filename
2129
2307
  );
2130
- writeFileSync10(outputPath, output, "utf8");
2308
+ writeFileSync11(outputPath, output, "utf8");
2131
2309
  loader.succeed(
2132
2310
  `Saved control-flow-packer file to: ${outputPath} (${diff(fileContent, output).length} lines changed, ${changedCount} edits)`
2133
2311
  );
@@ -2153,35 +2331,35 @@ var control_flow_packer_default = createCommand((program3) => {
2153
2331
  });
2154
2332
 
2155
2333
  // commands/fn-inliner/index.ts
2156
- import { readFileSync as readFileSync12, writeFileSync as writeFileSync11 } from "fs";
2157
- import { basename as basename11, dirname as dirname11, extname as extname11, join as join11 } from "path";
2158
- import { parse as parse12 } from "@babel/parser";
2159
- import traverse11 from "@babel/traverse";
2160
- import generate11 from "@babel/generator";
2161
- import * as t10 from "@babel/types";
2162
- import loading12 from "loading-cli";
2163
- var walk3 = patchDefault(traverse11);
2164
- var createDefaultOutputPath11 = (inputPath) => {
2165
- const ext = extname11(inputPath);
2334
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "fs";
2335
+ import { basename as basename12, dirname as dirname12, extname as extname12, join as join12 } from "path";
2336
+ import { parse as parse13 } from "@babel/parser";
2337
+ import traverse12 from "@babel/traverse";
2338
+ import generate12 from "@babel/generator";
2339
+ import * as t11 from "@babel/types";
2340
+ import loading13 from "loading-cli";
2341
+ var walk4 = patchDefault(traverse12);
2342
+ var createDefaultOutputPath12 = (inputPath) => {
2343
+ const ext = extname12(inputPath);
2166
2344
  if (!ext) {
2167
2345
  return `${inputPath}.fn-inliner.js`;
2168
2346
  }
2169
- const base = basename11(inputPath, ext);
2170
- return join11(dirname11(inputPath), `${base}.fn-inliner${ext}`);
2347
+ const base = basename12(inputPath, ext);
2348
+ return join12(dirname12(inputPath), `${base}.fn-inliner${ext}`);
2171
2349
  };
2172
2350
  var isProxyFunctionExpression = (node) => {
2173
- return t10.isFunction(node) && node.params.every((param) => t10.isIdentifier(param)) && (t10.isBlockStatement(node.body) && node.body.body.length === 1 && t10.isReturnStatement(node.body.body[0]) && (node.body.body[0].argument === void 0 || t10.isExpression(node.body.body[0].argument) && isProxyValue(node.body.body[0].argument)) || t10.isArrowFunctionExpression(node) && t10.isExpression(node.body) && isProxyValue(node.body));
2351
+ return t11.isFunction(node) && node.params.every((param) => t11.isIdentifier(param)) && (t11.isBlockStatement(node.body) && node.body.body.length === 1 && t11.isReturnStatement(node.body.body[0]) && (node.body.body[0].argument === void 0 || t11.isExpression(node.body.body[0].argument) && isProxyValue(node.body.body[0].argument)) || t11.isArrowFunctionExpression(node) && t11.isExpression(node.body) && isProxyValue(node.body));
2174
2352
  };
2175
2353
  var isProxyValue = (node) => {
2176
- if (t10.isFunction(node) || t10.isBlockStatement(node) || t10.isSequenceExpression(node) || t10.isAssignmentExpression(node)) {
2354
+ if (t11.isFunction(node) || t11.isBlockStatement(node) || t11.isSequenceExpression(node) || t11.isAssignmentExpression(node)) {
2177
2355
  return false;
2178
2356
  }
2179
2357
  let isValid = true;
2180
- if (!t10.isExpression(node)) {
2358
+ if (!t11.isExpression(node)) {
2181
2359
  return false;
2182
2360
  }
2183
- const wrapper = t10.file(t10.program([t10.expressionStatement(node)]));
2184
- walk3(wrapper, {
2361
+ const wrapper = t11.file(t11.program([t11.expressionStatement(node)]));
2362
+ walk4(wrapper, {
2185
2363
  "SequenceExpression|BlockStatement|Function|AssignmentExpression"(path) {
2186
2364
  isValid = false;
2187
2365
  path.stop();
@@ -2191,7 +2369,7 @@ var isProxyValue = (node) => {
2191
2369
  return isValid;
2192
2370
  };
2193
2371
  var copyExpression = (expression) => {
2194
- return t10.cloneNode(expression, true);
2372
+ return t11.cloneNode(expression, true);
2195
2373
  };
2196
2374
  var ProxyFunction = class {
2197
2375
  expression;
@@ -2199,7 +2377,7 @@ var ProxyFunction = class {
2199
2377
  this.expression = expression;
2200
2378
  }
2201
2379
  getReplacement(args) {
2202
- const expression = t10.isExpression(this.expression.body) ? copyExpression(this.expression.body) : this.expression.body.body[0].argument ? copyExpression(this.expression.body.body[0].argument) : t10.identifier("undefined");
2380
+ const expression = t11.isExpression(this.expression.body) ? copyExpression(this.expression.body) : this.expression.body.body[0].argument ? copyExpression(this.expression.body.body[0].argument) : t11.identifier("undefined");
2203
2381
  this.replaceParameters(expression, args);
2204
2382
  return expression;
2205
2383
  }
@@ -2207,7 +2385,7 @@ var ProxyFunction = class {
2207
2385
  const paramMap = new Map(
2208
2386
  this.expression.params.map((param, index) => [
2209
2387
  param.name,
2210
- args[index] ?? t10.identifier("undefined")
2388
+ args[index] ?? t11.identifier("undefined")
2211
2389
  ])
2212
2390
  );
2213
2391
  const pathsToReplace = [];
@@ -2232,10 +2410,10 @@ var ProxyFunction = class {
2232
2410
  }
2233
2411
  return false;
2234
2412
  };
2235
- const wrapper = t10.file(t10.program([t10.expressionStatement(expression)]));
2236
- walk3(wrapper, {
2413
+ const wrapper = t11.file(t11.program([t11.expressionStatement(expression)]));
2414
+ walk4(wrapper, {
2237
2415
  enter(path) {
2238
- if (t10.isIdentifier(path.node) && !shouldSkipIdentifier(path) && paramMap.has(path.node.name)) {
2416
+ if (t11.isIdentifier(path.node) && !shouldSkipIdentifier(path) && paramMap.has(path.node.name)) {
2239
2417
  const replacement = paramMap.get(path.node.name);
2240
2418
  pathsToReplace.push([path, replacement]);
2241
2419
  }
@@ -2243,7 +2421,7 @@ var ProxyFunction = class {
2243
2421
  noScope: true
2244
2422
  });
2245
2423
  for (const [path, replacement] of pathsToReplace) {
2246
- path.replaceWith(t10.cloneNode(replacement, true));
2424
+ path.replaceWith(t11.cloneNode(replacement, true));
2247
2425
  }
2248
2426
  }
2249
2427
  };
@@ -2263,10 +2441,10 @@ var ProxyFunctionVariable = class extends ProxyFunction {
2263
2441
  const argumentNodes = path.parentPath.node.arguments;
2264
2442
  const args = [];
2265
2443
  for (const argument of argumentNodes) {
2266
- if (!t10.isExpression(argument)) {
2444
+ if (!t11.isExpression(argument)) {
2267
2445
  return false;
2268
2446
  }
2269
- args.push(t10.cloneNode(argument, true));
2447
+ args.push(t11.cloneNode(argument, true));
2270
2448
  }
2271
2449
  const expression = this.getReplacement(args);
2272
2450
  path.parentPath.replaceWith(expression);
@@ -2275,7 +2453,7 @@ var ProxyFunctionVariable = class extends ProxyFunction {
2275
2453
  };
2276
2454
  var collectProxyFunctions = (ast) => {
2277
2455
  const proxies = [];
2278
- walk3(ast, {
2456
+ walk4(ast, {
2279
2457
  FunctionDeclaration(path) {
2280
2458
  if (!path.node.id) return;
2281
2459
  if (!isProxyFunctionExpression(path.node)) return;
@@ -2284,7 +2462,7 @@ var collectProxyFunctions = (ast) => {
2284
2462
  proxies.push(new ProxyFunctionVariable(binding, path.node));
2285
2463
  },
2286
2464
  VariableDeclarator(path) {
2287
- if (!t10.isIdentifier(path.node.id)) return;
2465
+ if (!t11.isIdentifier(path.node.id)) return;
2288
2466
  const init = path.node.init;
2289
2467
  if (!init || !isProxyFunctionExpression(init)) return;
2290
2468
  const binding = path.scope.getBinding(path.node.id.name);
@@ -2295,7 +2473,7 @@ var collectProxyFunctions = (ast) => {
2295
2473
  return proxies;
2296
2474
  };
2297
2475
  var inlineProxyFunctions = (code, filename) => {
2298
- const ast = parse12(code, createParseOptions(filename));
2476
+ const ast = parse13(code, createParseOptions(filename));
2299
2477
  const proxies = collectProxyFunctions(ast);
2300
2478
  let replacedCount = 0;
2301
2479
  for (const proxy of proxies) {
@@ -2307,7 +2485,7 @@ var inlineProxyFunctions = (code, filename) => {
2307
2485
  }
2308
2486
  }
2309
2487
  return {
2310
- code: patchDefault(generate11)(ast).code,
2488
+ code: patchDefault(generate12)(ast).code,
2311
2489
  replacedCount
2312
2490
  };
2313
2491
  };
@@ -2322,20 +2500,20 @@ var fn_inliner_default = createCommand((program3) => {
2322
2500
  return finish();
2323
2501
  }
2324
2502
  try {
2325
- const fileContent = readFileSync12(filename, "utf8");
2326
- const defaultOutputPath = createDefaultOutputPath11(filename);
2503
+ const fileContent = readFileSync13(filename, "utf8");
2504
+ const defaultOutputPath = createDefaultOutputPath12(filename);
2327
2505
  let outputPath = options.output;
2328
2506
  if (!outputPath) {
2329
2507
  const promptPath = (await createPrompt("Enter the output file path:"))?.trim();
2330
2508
  outputPath = promptPath || defaultOutputPath;
2331
2509
  }
2332
- const loader = loading12("Inlining proxy functions...").start();
2510
+ const loader = loading13("Inlining proxy functions...").start();
2333
2511
  try {
2334
2512
  const { code: output, replacedCount } = inlineProxyFunctions(
2335
2513
  fileContent,
2336
2514
  filename
2337
2515
  );
2338
- writeFileSync11(outputPath, output, "utf8");
2516
+ writeFileSync12(outputPath, output, "utf8");
2339
2517
  loader.succeed(
2340
2518
  `Saved fn-inliner file to: ${outputPath} (${diff(fileContent, output).length} lines changed, ${replacedCount} replacements)`
2341
2519
  );
@@ -2361,38 +2539,38 @@ var fn_inliner_default = createCommand((program3) => {
2361
2539
  });
2362
2540
 
2363
2541
  // commands/sequence-split/index.ts
2364
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "fs";
2365
- import { basename as basename12, dirname as dirname12, extname as extname12, join as join12 } from "path";
2366
- import { parse as parse13 } from "@babel/parser";
2367
- import traverse12 from "@babel/traverse";
2368
- import generate12 from "@babel/generator";
2369
- import * as t11 from "@babel/types";
2370
- import loading13 from "loading-cli";
2371
- var walk4 = patchDefault(traverse12);
2372
- var createDefaultOutputPath12 = (inputPath) => {
2373
- const ext = extname12(inputPath);
2542
+ import { readFileSync as readFileSync14, writeFileSync as writeFileSync13 } from "fs";
2543
+ import { basename as basename13, dirname as dirname13, extname as extname13, join as join13 } from "path";
2544
+ import { parse as parse14 } from "@babel/parser";
2545
+ import traverse13 from "@babel/traverse";
2546
+ import generate13 from "@babel/generator";
2547
+ import * as t12 from "@babel/types";
2548
+ import loading14 from "loading-cli";
2549
+ var walk5 = patchDefault(traverse13);
2550
+ var createDefaultOutputPath13 = (inputPath) => {
2551
+ const ext = extname13(inputPath);
2374
2552
  if (!ext) {
2375
2553
  return `${inputPath}.sequence-split.js`;
2376
2554
  }
2377
- const base = basename12(inputPath, ext);
2378
- return join12(dirname12(inputPath), `${base}.sequence-split${ext}`);
2555
+ const base = basename13(inputPath, ext);
2556
+ return join13(dirname13(inputPath), `${base}.sequence-split${ext}`);
2379
2557
  };
2380
2558
  var isExcluded = (node) => {
2381
- return t11.isIdentifier(node) && node.name === "eval";
2559
+ return t12.isIdentifier(node) && node.name === "eval";
2382
2560
  };
2383
2561
  var sequenceSplit = (code, filename) => {
2384
- const ast = parse13(code, createParseOptions(filename));
2562
+ const ast = parse14(code, createParseOptions(filename));
2385
2563
  let changedCount = 0;
2386
2564
  const markChanged = () => {
2387
2565
  changedCount += 1;
2388
2566
  };
2389
- walk4(ast, {
2567
+ walk5(ast, {
2390
2568
  ConditionalExpression(path) {
2391
2569
  if (!path.parentPath || !path.parentPath.isExpressionStatement()) return;
2392
- const replacement = t11.ifStatement(
2570
+ const replacement = t12.ifStatement(
2393
2571
  path.node.test,
2394
- t11.expressionStatement(path.node.consequent),
2395
- t11.expressionStatement(path.node.alternate)
2572
+ t12.expressionStatement(path.node.consequent),
2573
+ t12.expressionStatement(path.node.alternate)
2396
2574
  );
2397
2575
  if (path.parentPath.parentPath && path.parentPath.parentPath.key === "alternate" && path.parentPath.parentPath.isBlockStatement() && path.parentPath.parentPath.node.body.length === 1) {
2398
2576
  path.parentPath.parentPath.replaceWith(replacement);
@@ -2405,10 +2583,10 @@ var sequenceSplit = (code, filename) => {
2405
2583
  LogicalExpression(path) {
2406
2584
  if (!path.parentPath || !path.parentPath.isExpressionStatement()) return;
2407
2585
  if (path.node.operator !== "&&" && path.node.operator !== "||") return;
2408
- const test = path.node.operator === "&&" ? path.node.left : t11.unaryExpression("!", path.node.left);
2409
- const replacement = t11.ifStatement(
2586
+ const test = path.node.operator === "&&" ? path.node.left : t12.unaryExpression("!", path.node.left);
2587
+ const replacement = t12.ifStatement(
2410
2588
  test,
2411
- t11.expressionStatement(path.node.right)
2589
+ t12.expressionStatement(path.node.right)
2412
2590
  );
2413
2591
  if (path.parentPath.parentPath && path.parentPath.parentPath.key === "alternate" && path.parentPath.parentPath.isBlockStatement() && path.parentPath.parentPath.node.body.length === 1) {
2414
2592
  path.parentPath.parentPath.replaceWith(replacement);
@@ -2420,24 +2598,24 @@ var sequenceSplit = (code, filename) => {
2420
2598
  },
2421
2599
  "ForStatement|WhileStatement|DoWhileStatement"(path) {
2422
2600
  if (!path.isForStatement() && !path.isWhileStatement() && !path.isDoWhileStatement()) return;
2423
- if (t11.isBlockStatement(path.node.body)) return;
2424
- path.node.body = t11.blockStatement([path.node.body]);
2601
+ if (t12.isBlockStatement(path.node.body)) return;
2602
+ path.node.body = t12.blockStatement([path.node.body]);
2425
2603
  markChanged();
2426
2604
  },
2427
2605
  IfStatement(path) {
2428
- if (!t11.isBlockStatement(path.node.consequent)) {
2429
- path.node.consequent = t11.blockStatement([path.node.consequent]);
2606
+ if (!t12.isBlockStatement(path.node.consequent)) {
2607
+ path.node.consequent = t12.blockStatement([path.node.consequent]);
2430
2608
  markChanged();
2431
2609
  }
2432
- if (path.node.alternate && !t11.isBlockStatement(path.node.alternate) && !t11.isIfStatement(path.node.alternate)) {
2433
- path.node.alternate = t11.blockStatement([path.node.alternate]);
2610
+ if (path.node.alternate && !t12.isBlockStatement(path.node.alternate) && !t12.isIfStatement(path.node.alternate)) {
2611
+ path.node.alternate = t12.blockStatement([path.node.alternate]);
2434
2612
  markChanged();
2435
2613
  }
2436
2614
  },
2437
2615
  VariableDeclaration(path) {
2438
2616
  if (path.node.declarations.length <= 1) return;
2439
2617
  const replacements = path.node.declarations.map(
2440
- (declaration) => t11.variableDeclaration(path.node.kind, [declaration])
2618
+ (declaration) => t12.variableDeclaration(path.node.kind, [declaration])
2441
2619
  );
2442
2620
  if (path.parentPath?.isForStatement() && path.parentKey === "init") {
2443
2621
  const lastDeclaration = replacements.pop();
@@ -2458,7 +2636,7 @@ var sequenceSplit = (code, filename) => {
2458
2636
  return;
2459
2637
  }
2460
2638
  let outerPath = path;
2461
- while (!t11.isStatement(outerPath.node)) {
2639
+ while (!t12.isStatement(outerPath.node)) {
2462
2640
  const parent = outerPath.parentPath;
2463
2641
  if (!parent) return;
2464
2642
  if (parent.isConditionalExpression() && (outerPath.key === "consequent" || outerPath.key === "alternate") || parent.isLogicalExpression() && outerPath.key === "right" || parent.isForStatement() && (outerPath.key === "test" || outerPath.key === "update") || parent.isDoWhileStatement() && outerPath.key === "test" || parent.isArrowFunctionExpression() && outerPath.key === "body") {
@@ -2471,7 +2649,7 @@ var sequenceSplit = (code, filename) => {
2471
2649
  const firstExpressions = expressions.splice(0, expressions.length - 2);
2472
2650
  if (firstExpressions.length > 0) {
2473
2651
  const expressionStatements = firstExpressions.map(
2474
- (expression) => t11.expressionStatement(expression)
2652
+ (expression) => t12.expressionStatement(expression)
2475
2653
  );
2476
2654
  outerPath.insertBefore(expressionStatements);
2477
2655
  markChanged();
@@ -2479,7 +2657,7 @@ var sequenceSplit = (code, filename) => {
2479
2657
  } else {
2480
2658
  const finalExpression = expressions.splice(expressions.length - 1, 1)[0];
2481
2659
  const expressionStatements = expressions.map(
2482
- (expression) => t11.expressionStatement(expression)
2660
+ (expression) => t12.expressionStatement(expression)
2483
2661
  );
2484
2662
  outerPath.insertBefore(expressionStatements);
2485
2663
  if (finalExpression) {
@@ -2490,7 +2668,7 @@ var sequenceSplit = (code, filename) => {
2490
2668
  }
2491
2669
  });
2492
2670
  return {
2493
- code: patchDefault(generate12)(ast).code,
2671
+ code: patchDefault(generate13)(ast).code,
2494
2672
  changedCount
2495
2673
  };
2496
2674
  };
@@ -2505,20 +2683,20 @@ var sequence_split_default = createCommand((program3) => {
2505
2683
  return finish();
2506
2684
  }
2507
2685
  try {
2508
- const fileContent = readFileSync13(filename, "utf8");
2509
- const defaultOutputPath = createDefaultOutputPath12(filename);
2686
+ const fileContent = readFileSync14(filename, "utf8");
2687
+ const defaultOutputPath = createDefaultOutputPath13(filename);
2510
2688
  let outputPath = options.output;
2511
2689
  if (!outputPath) {
2512
2690
  const promptPath = (await createPrompt("Enter the output file path:"))?.trim();
2513
2691
  outputPath = promptPath || defaultOutputPath;
2514
2692
  }
2515
- const loader = loading13("Splitting sequences...").start();
2693
+ const loader = loading14("Splitting sequences...").start();
2516
2694
  try {
2517
2695
  const { code: output, changedCount } = sequenceSplit(
2518
2696
  fileContent,
2519
2697
  filename
2520
2698
  );
2521
- writeFileSync12(outputPath, output, "utf8");
2699
+ writeFileSync13(outputPath, output, "utf8");
2522
2700
  loader.succeed(
2523
2701
  `Saved sequence-split file to: ${outputPath} (${diff(fileContent, output).length} lines changed, ${changedCount} transforms)`
2524
2702
  );
@@ -2567,10 +2745,10 @@ var calmGradienrain = (text) => {
2567
2745
  const endHue = 300;
2568
2746
  const saturation = 0.45;
2569
2747
  const value = 0.8;
2570
- const ease = (t12) => t12 * t12 * (3 - 2 * t12);
2748
+ const ease = (t13) => t13 * t13 * (3 - 2 * t13);
2571
2749
  return text.split("").map((char, i) => {
2572
- const t12 = ease(i / Math.max(text.length - 1, 1));
2573
- const hue = startHue + (endHue - startHue) * t12;
2750
+ const t13 = ease(i / Math.max(text.length - 1, 1));
2751
+ const hue = startHue + (endHue - startHue) * t13;
2574
2752
  const c = value * saturation;
2575
2753
  const h = hue / 60;
2576
2754
  const x = c * (1 - Math.abs(h % 2 - 1));
@@ -2594,11 +2772,11 @@ ${calmGradienrain(`Expose Kit v${VERSION}`)} ${update && update.latest !== VERSI
2594
2772
  `;
2595
2773
 
2596
2774
  // index.ts
2597
- import { readFileSync as readFileSync14 } from "fs";
2775
+ import { readFileSync as readFileSync15 } from "fs";
2598
2776
  import updateNotifier from "update-notifier";
2599
2777
  var __filename = fileURLToPath(import.meta.url);
2600
- var __dirname = dirname13(__filename);
2601
- var pkg = JSON.parse(readFileSync14(join13(__dirname, "package.json"), "utf8"));
2778
+ var __dirname = dirname14(__filename);
2779
+ var pkg = JSON.parse(readFileSync15(join14(__dirname, "package.json"), "utf8"));
2602
2780
  var notifier = updateNotifier({
2603
2781
  pkg,
2604
2782
  updateCheckInterval: 1e3 * 60 * 60 * 24 * 3
@@ -2622,6 +2800,7 @@ var commands = [
2622
2800
  remove_updater_default,
2623
2801
  remove_reassign_default,
2624
2802
  remove_deadcode_default,
2803
+ remove_anti_tamper_default,
2625
2804
  control_flow_packer_default,
2626
2805
  fn_inliner_default,
2627
2806
  remove_unused_default,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expose-kit",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expose-kit",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",