(name: string)
| 444 | } |
| 445 | |
| 446 | export function cleanFileName(name: string): string { |
| 447 | // https://github.com/Tampermonkey/tampermonkey/issues/2413 |
| 448 | // https://developer.chrome.com/docs/extensions/reference/api/downloads#type-DownloadOptions |
| 449 | // A file path relative to the Downloads directory to contain the downloaded file, possibly containing subdirectories. |
| 450 | // Absolute paths, empty paths, and paths containing back-references ".." will cause an error. |
| 451 | let n = name; |
| 452 | // eslint-disable-next-line no-control-regex |
| 453 | n = n.replace(/[\x00-\x1F\\:*?"<>|]+/g, "-"); |
| 454 | return n.replace(/\.\.+/g, "-").trim(); |
| 455 | } |
| 456 | |
| 457 | export const sourceMapTo = (scriptName: string) => { |
| 458 | // sandbox 环境中 chrome.runtime 不可用,使用脚本名作为 sourceURL |
no outgoing calls
no test coverage detected