diff --git a/internal/check-composite-embed-knobs.mjs b/internal/check-composite-embed-knobs.mjs index 8afabb04e..6220e29c1 100644 --- a/internal/check-composite-embed-knobs.mjs +++ b/internal/check-composite-embed-knobs.mjs @@ -74,6 +74,7 @@ for (const b of manifest.bundles || []) { if ((b.profiles || []).some((p) => p.isMap)) mapBundles.add(b.bundle) } const targets = [] +const mapless = [] // composites that nest no map: reported as N/A, never as unmeasured for (const b of manifest.bundles || []) { // TWO WAYS A COMPOSITE DECLARES ITSELF, and taking only the first under-covered this gate. // `composes` is written when a composite mounts children BY TAG; a composite that BAKES its @@ -84,8 +85,24 @@ for (const b of manifest.bundles || []) { const byCompose = composes.some((c) => mapBundles.has(c)) const profile = (b.profiles || []).find((p) => p.element && (byCompose || p.type === 'nested-elements-mfe')) if (!profile || !b.scriptUrl) continue + // ★ A COMPOSITE WITH NO MAP IS NOT A MAP-EMBED TARGET, and counting it as one buys a permanent + // UNMEASURED that reads like a gap. The `type` arm above is deliberately loose — country-posters-mfe + // BAKES its children, so `composes` names nothing — but loose enough to admit composites that nest no + // map at all: bp-big-picture composes a research HEADER and a people-groups GRID, and its built + // bundle contains zero occurrences of mapbox-gl or maplibre-gl. It can never draw a canvas, so + // "no canvas under a minimal config" was the honest answer to a question that should not have been + // asked of it. Decided on the BUILT artefact rather than the manifest, because whether a bundle + // ships an engine is a fact about what it compiled, not about what it declares. + if (!byCompose) { + let js = '' + try { js = readFileSync(resolve(ROOT, 'public', TREE_NAME, b.bundle, `${b.bundle}.js`), 'utf8') } catch (_) { js = '' } + if (js && !/mapbox-gl|maplibre-gl/.test(js)) { mapless.push(`${profile.element} (${b.bundle})`); continue } + } targets.push({ bundle: b.bundle, element: profile.element, profile: profile.profile, script: `${b.bundle}/${b.bundle}.js` }) } +if (mapless.length) { + console.log(` · ${mapless.length} composite(s) nest NO map, so the knobs do not apply and they are not targets: ${mapless.join(', ')}`) +} if (!targets.length) { console.log('COMPOSITE-EMBED-KNOBS: SKIP — the manifest declares no composite that nests a map.') process.exit(0)