(node, respMap)
| 1960 | |
| 1961 | // 适配 maven |
| 1962 | function procMaven(node, respMap) { |
| 1963 | let text = format(node.textContent); |
| 1964 | if (text && withoutChinese(text)) { |
| 1965 | // 处理 “Indexed Repositories (1936)” 与 “Indexed Artifacts (1.2M)” 的格式 |
| 1966 | let repositoriesMatch = text.match(regex.repositoriesRegex); |
| 1967 | if (repositoriesMatch) { |
| 1968 | let count = parseInt(repositoriesMatch[2], 10); |
| 1969 | node.textContent = repositoriesMatch[1] === "Repositories" ? `索引库数量(${count})` : `索引包数量(${count * 100}万)`; |
| 1970 | return; |
| 1971 | } |
| 1972 | // 匹配并处理 "indexed packages" 的格式 |
| 1973 | let packagesMatch = text.match(regex.packagesRegex); |
| 1974 | if (packagesMatch) { |
| 1975 | let count = parseInt(packagesMatch[1].replace(/,/g, ''), 10); // 移除数字中的逗号,然后转换为整数 |
| 1976 | node.textContent = `${count.toLocaleString()}个索引包`; |
| 1977 | return; |
| 1978 | } |
| 1979 | // 处理“Last Release on”格式的日期 |
| 1980 | let lastReleaseMatch = text.match(regex.lastReleaseRegex); |
| 1981 | if (lastReleaseMatch) { |
| 1982 | let date = new Date(`${lastReleaseMatch[1]} ${lastReleaseMatch[2]}, ${lastReleaseMatch[3]}`); |
| 1983 | node.textContent = `Last Release on ${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; |
| 1984 | return; |
| 1985 | } |
| 1986 | // 处理日期格式 |
| 1987 | let dateOrFalse = parseDateOrFalse(text); |
| 1988 | if (dateOrFalse) { |
| 1989 | node.textContent = `${dateOrFalse.getFullYear()}-${String(dateOrFalse.getMonth() + 1).padStart(2, '0')}-${String(dateOrFalse.getDate()).padStart(2, '0')}`; |
| 1990 | return; |
| 1991 | } |
| 1992 | // 处理依赖类型 |
| 1993 | let dependencyMatch = text.match(regex.dependencyRegex); |
| 1994 | if (dependencyMatch) { |
| 1995 | let [_, type, count] = dependencyMatch; |
| 1996 | node.textContent = `${regex.typeMap[type] || type}依赖 ${type} (${count})`; |
| 1997 | return; |
| 1998 | } |
| 1999 | // 处理排名 |
| 2000 | let rankMatch = text.match(regex.rankRegex); |
| 2001 | if (rankMatch) { |
| 2002 | node.textContent = `第 ${rankMatch[1]} 位 ${rankMatch[2]}`; |
| 2003 | return; |
| 2004 | } |
| 2005 | // 处理 artifacts 被引用次数 |
| 2006 | let artifactsMatch = text.match(regex.artifactsRegex); |
| 2007 | if (artifactsMatch) { |
| 2008 | node.textContent = `被引用 ${artifactsMatch[1]} 次`; |
| 2009 | return; |
| 2010 | } |
| 2011 | // 处理漏洞数量 |
| 2012 | let vulnerabilityMatch = text.match(regex.vulnerabilityRegex); |
| 2013 | if (vulnerabilityMatch) { |
| 2014 | node.textContent = `${vulnerabilityMatch[1]}个漏洞`; |
| 2015 | return; |
| 2016 | } |
| 2017 | |
| 2018 | processNode(node, textType.textContent, respMap); |
| 2019 | } |
nothing calls this directly
no test coverage detected