opensteer 0.7.0 → 0.7.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/cli/bin.cjs CHANGED
@@ -17,7 +17,6 @@ var module$1 = require('module');
17
17
  var cssSelect = require('css-select');
18
18
  var cheerio = require('cheerio');
19
19
  var prettier = require('prettier');
20
- var webcrack = require('webcrack');
21
20
  var vm = require('vm');
22
21
  var index_js = require('@modelcontextprotocol/sdk/server/index.js');
23
22
  var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
@@ -25645,8 +25644,11 @@ async function beautifyScriptContent(content) {
25645
25644
  cause: lastError
25646
25645
  });
25647
25646
  }
25647
+
25648
+ // src/scripts/deobfuscate.ts
25648
25649
  async function deobfuscateScriptContent(input) {
25649
- const result = await webcrack.webcrack(input.content, {
25650
+ const webcrack = await loadWebcrack();
25651
+ const result = await webcrack(input.content, {
25650
25652
  unpack: false,
25651
25653
  deobfuscate: true,
25652
25654
  unminify: true,
@@ -25659,6 +25661,22 @@ async function deobfuscateScriptContent(input) {
25659
25661
  transforms: inferTransforms(input.content, content)
25660
25662
  };
25661
25663
  }
25664
+ async function loadWebcrack() {
25665
+ try {
25666
+ const { webcrack } = await import('webcrack');
25667
+ return webcrack;
25668
+ } catch (error) {
25669
+ if (isMissingPackageError2(error, "webcrack")) {
25670
+ throw new Error(
25671
+ 'Script deobfuscation requires the optional "webcrack" dependency. Install it with `npm install webcrack` in the environment running Opensteer.'
25672
+ );
25673
+ }
25674
+ throw error;
25675
+ }
25676
+ }
25677
+ function isMissingPackageError2(error, packageName) {
25678
+ return error instanceof Error && "code" in error && error.code === "ERR_MODULE_NOT_FOUND" && error.message.includes(packageName);
25679
+ }
25662
25680
  function inferTransforms(original, deobfuscated) {
25663
25681
  if (original === deobfuscated) {
25664
25682
  return [];