(node)
| 55 | } |
| 56 | |
| 57 | function collectUrlsToCheck(node) { |
| 58 | const nodesToVisit = [node]; |
| 59 | const urlsToCheck = []; |
| 60 | while (nodesToVisit.length) { |
| 61 | const currentNode = nodesToVisit.shift(); |
| 62 | if (currentNode.kind === ts.SyntaxKind.StringLiteral || |
| 63 | currentNode.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral) { |
| 64 | const checkUrl = ORIGIN_PATTERNS_TO_CHECK.some( |
| 65 | originPattern => originPattern.test(currentNode.text), |
| 66 | ); |
| 67 | if (checkUrl) { |
| 68 | urlsToCheck.push(currentNode.text); |
| 69 | } |
| 70 | } |
| 71 | nodesToVisit.push(...currentNode.getChildren()); |
| 72 | } |
| 73 | return urlsToCheck; |
| 74 | } |
| 75 | |
| 76 | async function collectUrlsToCheckFromFile(filePath) { |
| 77 | const content = await readFileAsync(filePath, 'utf8'); |
no test coverage detected