mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 18:52:18 +00:00
Load the layer displays lazily and rebase the main-chunk budget
Every layer display was imported statically from the manifest, so all of them sat in the Cesium-mode main chunk. They are re-exported from one module, src/app/layers/displays.js, which the manifest loads with one import() before the catalog is built, on every engine; rendererFor stays synchronous after that. One chunk beats per-family chunks here: every start loads every display, and split chunks compress worse. CCTV's world click gesture moves out of its display, which the app imported only for it. Tests that build layers without the application await the loads. Keyless, gzip-9: the main chunk falls from 2,113,641 to 2,066,560 bytes, below the 2,090,274 of the merge with main this branch carries. A cold Cesium start loads about 7 KB more JS in total over four requests, with the same time to a ready page. The budget's baseline moves to the new size; it had never absorbed main's own growth.
This commit is contained in:
1 parent
47d63128ff
commit
b53b6a48a7
22 files changed
+239
-114
No files matched your search
@@ -1291,6 +1291,11 @@ test('unsupported ALPR coverage suppresses the nearby count and names the extrac
|
||||
import { createGroundFloor } from '../services/groundFloor.js';
|
||||
import { createTerrainHeights } from '../services/terrainHeights.js';
|
||||
import { createApplicationRequestServices } from '../services/requests.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
test('slow ALPR floors share real terrain requests across preparation, render and pans; disable aborts', async () => {
|
||||
const requests = [];
|
||||
|
||||
@@ -10,6 +10,11 @@ import {
|
||||
_setBikeshareSelectionStateForTest,
|
||||
createBikeshareSelectedOverlayEntry,
|
||||
} from './bikeshare.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
function makeRecord() {
|
||||
return {
|
||||
|
||||
@@ -83,6 +83,11 @@ import {
|
||||
IDLE_CAMERA_COLOR,
|
||||
LIVE_CAMERA_COLOR,
|
||||
} from '../layers/cctv/policy.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const ASPECT = 16 / 9;
|
||||
const toRad = (deg) => (deg * Math.PI) / 180;
|
||||
|
||||
@@ -11,6 +11,11 @@ import cctvLayer, {
|
||||
_viewRecordIdsForTest,
|
||||
refreshHorizonCulling,
|
||||
} from './cctv.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const WIDTH = 800;
|
||||
const HEIGHT = 600;
|
||||
|
||||
@@ -20,6 +20,11 @@ import {
|
||||
installRenderGovernor,
|
||||
_resetRenderGovernorForTest,
|
||||
} from '../renderGovernor.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const FULL_RAW = {
|
||||
id: 'us7000abcd',
|
||||
|
||||
@@ -18,6 +18,11 @@ import { getLocale, setLocale } from '../i18n/index.js';
|
||||
import { reportMeshFloorCell, setMeshFloorPreferred } from './groundFloor.js';
|
||||
import { createCesiumMoversEngine } from '../testSupport/cesiumMoversEngine.mjs';
|
||||
import { createFakeEventHandlers } from '../globe/cesium/testing/fakeViewer.mjs';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const NOW = Date.UTC(2026, 6, 17, 4, 0);
|
||||
const H = 3600000;
|
||||
|
||||
@@ -26,6 +26,11 @@ import {
|
||||
import * as Cesium from 'cesium';
|
||||
import { getContextStore, registerEntityContext, selectEntityContext, getSelectedEntityContext, clearSelectedEntityContextForLayer } from './contextStore.js';
|
||||
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const LAYER_ID = 'military-installations';
|
||||
|
||||
|
||||
@@ -53,6 +53,11 @@ import {
|
||||
} from './radio.js';
|
||||
import { radioStationRow, withRadioLayer } from '../testSupport/radioLayerHarness.mjs';
|
||||
import { radioSelectedMarker, radioTestEngine } from '../testSupport/radioTestEngine.mjs';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const stations = [
|
||||
{ id: 'news', tags: ['News', 'Weather Radio', 'air traffic'] },
|
||||
|
||||
@@ -5,6 +5,11 @@ import { radioLayer } from './radio.js';
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
import { renderRadioState } from '../ui/radioPresentation.js';
|
||||
import { radioStationRow, withRadioLayer } from '../testSupport/radioLayerHarness.mjs';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const READY = 'Ready — playback starts only from your action';
|
||||
const ids = [1, 2, 3].map((n) => `00000000-0000-4000-8000-00000000009${n}`);
|
||||
|
||||
@@ -20,6 +20,11 @@ import {
|
||||
import { RADIO_REJECTED_STATION_COUNT_MAX as SERVER_REJECTED_MAX } from '../../server/providers/radio/constants.js';
|
||||
import { RADIO_REJECTED_STATION_COUNT_MAX as CLIENT_REJECTED_MAX } from '../layers/radio/policy.js';
|
||||
import { radioTestEngine } from '../testSupport/radioTestEngine.mjs';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const UUID = '12345678-1234-4234-8234-123456789abc';
|
||||
const publicLookup = async () => [{ address: '93.184.216.34', family: 4 }];
|
||||
|
||||
@@ -66,6 +66,11 @@ import {
|
||||
satelliteCatalogModeChanged,
|
||||
scoreSatelliteNameMatch,
|
||||
} from './satellites.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const NOW = new Date('2026-07-27T00:00:00Z');
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ import {
|
||||
import satellitesLayer from './satellites.js';
|
||||
import { createTrackedOverlayEntry } from './trackedReadout.js';
|
||||
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const L1 =
|
||||
'1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927';
|
||||
|
||||
@@ -9,6 +9,11 @@ import {
|
||||
} from './satellites.js';
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
|
||||
import { loadLayerRenderers } from '../app/layers/renderers.js';
|
||||
|
||||
// The layers draw with the manifest's displays, which load through
|
||||
// import() (src/app/layers/renderers.js).
|
||||
await loadLayerRenderers('cesium');
|
||||
|
||||
const L1 =
|
||||
'1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927';
|
||||
|
||||
@@ -181,6 +181,10 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
|
||||
}],
|
||||
});
|
||||
const traffic = await server.ssrLoadModule('/src/data/traffic.js');
|
||||
// The layer draws with the manifest's display, which loads through
|
||||
// import() (src/app/layers/renderers.js), in this server's module graph.
|
||||
const renderers = await server.ssrLoadModule('/src/app/layers/renderers.js');
|
||||
await renderers.loadLayerRenderers('cesium');
|
||||
trafficLayer = traffic.default;
|
||||
|
||||
globalThis.document = { documentElement: { dataset: {} } };
|
||||
|
||||
Reference in new issue
Block a user