diff --git a/internal/generate-tree.mjs b/internal/generate-tree.mjs index 13ed3c5f3..8b849290f 100644 --- a/internal/generate-tree.mjs +++ b/internal/generate-tree.mjs @@ -851,12 +851,13 @@ const MAPLIBRE_STYLE_ORIGIN = 'https://tiles.openfreemap.org' // useMapInstanc * MapLibre, keyless. The runtime can still be overridden by ?tk=/?provider=/window.MAP_PROVIDER/a stored * token; the hint follows the build default and the report names that miss case (one unused preconnect). */ -function engineFor({ isMapLibre, config, tokenUrlExpr, bakedToken }) { - const asked = String((config && config.provider) || '').toLowerCase().trim() - if (isMapLibre || asked === 'maplibre') return 'maplibre' - if (asked === 'mapbox') return 'mapbox' - const hasEndpoint = !!(tokenUrlExpr && tokenUrlExpr !== 'window.MAP_TOKEN_URL') - return (bakedToken || hasEndpoint) ? 'mapbox' : 'maplibre' +function engineFor({ config }) { + // CORRECTED 2026-09-29 (regions executed the shipping resolver; rega's A9NET confirmed on the wire): + // a token no longer selects Mapbox. useMapProvider's default is MapLibre unless provider is EXPLICITLY + // 'mapbox'. rega measured all 8 auto leaves — which DO carry a pray.doxa.life token endpoint — loading + // MapLibre from jsdelivr cold. So the hint's engine is Mapbox ONLY when provider:'mapbox' is set; every + // other case (auto, or provider:'maplibre') is MapLibre, regardless of any baked token / tokenUrl. + return String((config && config.provider) || '').toLowerCase().trim() === 'mapbox' ? 'mapbox' : 'maplibre' } /** @@ -866,19 +867,21 @@ function engineFor({ isMapLibre, config, tokenUrlExpr, bakedToken }) { * and 'mapbox' branches already carry a static engine tag (mapPageHtml's peerBlock / the embed snippet), * so a preload there would double-fetch — those get preconnects only. Returns '' for a non-map leaf. */ -function resourceHints({ isMapLibre, config, apiBaseUrl, tokenUrlExpr, bakedToken }) { - const engine = engineFor({ isMapLibre, config, tokenUrlExpr, bakedToken }) +function resourceHints({ isMapLibre, config, apiBaseUrl }) { + const engine = engineFor({ config }) const styleOrigin = engine === 'maplibre' ? MAPLIBRE_STYLE_ORIGIN : ENGINE_ORIGIN.mapbox const dataOrigin = ORIGIN(apiBaseUrl) // '' when same-origin (no build apiBaseUrl): nothing to preconnect const origins = [...new Set([ENGINE_ORIGIN[engine], styleOrigin, dataOrigin].filter(Boolean))] const lines = origins.map((o) => ` `) - // 'auto' leaf only: it emits no engine