MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / collectUrlsToCheck

Function collectUrlsToCheck

scripts/check_external_links.js:57–74  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

55}
56
57function 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
76async function collectUrlsToCheckFromFile(filePath) {
77 const content = await readFileAsync(filePath, 'utf8');

Callers 1

Calls 3

someMethod · 0.80
getChildrenMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected