INNER CODE UNIT · TypeScript
isFloating
cyanheads/pubmed-mcp-server · scripts/check-dependency-specifiers.ts:69
function isFloating(specifier: string, section: DepSection): boolean {
const spec = specifier.trim();
if (spec === 'latest') return true; // never reproducible, in any section
if (HOST_SECTIONS.has(section)) return false; // `*` / dist-tags are legitimate here
return spec === '*' || FLOATING_DIST_TAGS.has(spec);
}
/** Scan every dependency-declaring section of one manifest object. */
function scanManifest(manifest: SectionedManifest, label: string): Offender[] {
const offenders: Offender[] = [];
for (const section of DEP_SECTIONS) {
const deps = manifest[section];
if (!deps || typeof deps !== 'object') continue;
for (const [name, specifier] of Object.entries(deps)) {
if (typeof specifier === 'string' && isFloating(specifier, section)) {
offenders.push({ name, specifier, location: `${label} ${section}` });
}
}