Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Rule replacement breaks xxx.framework.js #705

Open
labbbirder opened this issue Mar 12, 2024 · 1 comment
Open

[Bug] Rule replacement breaks xxx.framework.js #705

labbbirder opened this issue Mar 12, 2024 · 1 comment

Comments

@labbbirder
Copy link

有一条rule是这样的:

find:assert(typeof Module[(["'])pthreadMainPrefixURL(["'])]
repl:// assert(typeof Module["pthreadMainPrefixURL"]

xxx.framework.js是minified状态,使用//前缀导致文件语法错乱

建议官方把非核心的代码开源,方便我们开发者自己修改和PR

@labbbirder
Copy link
Author

As mentioned above, the solution is surrounding the pattern with /* */. Here is a proper rule:

    old = @"(assert\(typeof Module\[([""'])pthreadMainPrefixURL([""'])\][^\)]+\))",
    newStr = @"/*$0*/"

Additionally, there are semicolon missing issues as well.

The following snippet should fixes this:

  if (newStr.StartsWith("var "))
  {
      old = ";*" + old;
      newStr = ";" + newStr;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant