shenruisi / Stay

Stay is a local userscript manager and an extension sample for Safari on iOS/iPadOS.
https://github.com/shenruisi/Stay/wiki
Mozilla Public License 2.0
1.08k stars 65 forks source link

Comments in user script being removed #60

Open ppixiv opened 1 year ago

ppixiv commented 1 year ago

This is really strange. Comments in my script seem to be getting removed. For example:

// test1
/* test2 */
let s = `"use strict";
// test3
/* test4 */
foo();
`;

console.log(s);

This prints:

"use strict"
/* test4 */
foo();

The string "s" is missing the "// test3" line, and viewing it in the debugger, "// test1" is also missing.

This makes debugging harder (my comments are missing), and it breaks console logs and many debugger features since it strips out my sourceURLs. Any idea what's happening?

(iPhone 14, iOS 16.1, version 2.3.4)

shenruisi commented 1 year ago

@ppixiv This issue seems to be due to remove the comments when processing scripts to reduce the size of the script transfer, thanks for the feedback, this will be fixed in a later release.