(globs: string[])
| 396 | }; |
| 397 | |
| 398 | export const extractMatchPatternsFromGlobs = (globs: string[]): (string | null)[] => { |
| 399 | return globs.map((glob) => { |
| 400 | if (glob.startsWith("http*://")) { |
| 401 | glob = `*://${glob.substring(8)}`; |
| 402 | } |
| 403 | const extMatch = checkUrlMatch(glob); |
| 404 | if (!extMatch) return null; |
| 405 | const [scheme, host] = extMatch; |
| 406 | // glob 的 *.google.com 可以匹配 www.google.com 跟 my-website.com/abc.google.com |
| 407 | if (host.charAt(0) === ".") return null; |
| 408 | return `${scheme}://${host}/*`; |
| 409 | }); |
| 410 | }; |
| 411 | |
| 412 | export const extractSchemesOfGlobs = (globs: string[]): string[] => { |
| 413 | const set = new Set(["*://*/*"]); |
no test coverage detected