feat(plugins): move Bonjour discovery into bundled plugin

* fix(deps): detect constant dynamic imports in ownership audit

* feat(plugins): move bonjour discovery into bundled plugin

* test(plugins): remove moved bonjour core tests

* fix(plugins): harden bonjour disable and console restore

* fix(plugins): split gateway discovery ids from services

* fix(plugins): harden bonjour advertiser shutdown

* fix(plugins): clean up bonjour split lint
This commit is contained in:
Vincent Koc
2026-04-23 23:29:51 -07:00
committed by GitHub
parent 564f820efa
commit cb4fc58547
42 changed files with 849 additions and 204 deletions

View File

@@ -17,6 +17,12 @@ const IMPORT_PATTERNS = [
/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g,
/\b(?:require|[_$A-Za-z][\w$]*require[\w$]*)\.resolve\s*\(\s*["']([^"']+)["']\s*\)/gi,
];
const STRING_CONSTANT_PATTERN = /\b(?:const|let|var)\s+([_$A-Za-z][\w$]*)\s*=\s*["']([^"']+)["']/g;
const DYNAMIC_CONSTANT_IMPORT_PATTERNS = [
/\bimport\s*\(\s*([_$A-Za-z][\w$]*)\s*\)/g,
/\brequire\s*\(\s*([_$A-Za-z][\w$]*)\s*\)/g,
/\b(?:require|[_$A-Za-z][\w$]*require[\w$]*)\.resolve\s*\(\s*([_$A-Za-z][\w$]*)\s*\)/gi,
];
function readJson(filePath) {
return JSON.parse(fs.readFileSync(filePath, "utf8"));
@@ -73,6 +79,20 @@ export function collectModuleSpecifiers(source) {
}
}
}
const stringConstants = new Map();
for (const match of source.matchAll(STRING_CONSTANT_PATTERN)) {
if (match[1] && match[2]) {
stringConstants.set(match[1], match[2]);
}
}
for (const pattern of DYNAMIC_CONSTANT_IMPORT_PATTERNS) {
for (const match of source.matchAll(pattern)) {
const specifier = match[1] ? stringConstants.get(match[1]) : undefined;
if (specifier) {
specifiers.add(specifier);
}
}
}
return specifiers;
}