Skip to content

refactor: explicit public exports, elevation* naming, deprecations - #27

Open
kenjinp wants to merge 1 commit into
mainfrom
refactor/b5k2-public-surface
Open

kenjinp wants to merge 1 commit into
mainfrom
refactor/b5k2-public-surface

Conversation

@kenjinp

@kenjinp kenjinp commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

@hello-terrain/three re-exported the whole quadtree/ and tasks/ barrels, leaking the LOD driver internals; a few names still used heightmap where the spec says elevation.

  • index.ts now uses explicit named exports. Removed from the public surface: update, createState, beginUpdate, allocLeafSet, resetLeafSet, allocSeamTable, resetSeamTable, buildSeams2to1, SeamTable, buildLeafIndex, createSpatialIndex, U32_EMPTY, runTileBoundsReduction. The topology contract, factories, task refs, and graph data types stay public.
  • Dead code deleted: NodeFlags, isLive, NodeStore.flags, NodeStore.roots; createNodeStore(maxNodes) no longer takes spaceCount.
  • Renames with @deprecated aliases: sampleHeightmapMeters → sampleElevationTextureMeters, HeightmapTexture → ElevationTexture (module tsl/heightmap.ts → tsl/elevationTexture.ts), createTerrainFieldTextureTask → createTerrainFieldStorageTask.
  • Renamed outright (object keys, no alias): terrainTasks.createTerrainFieldTexture → createTerrainFieldStorage, terrainTasks.createTileNodes → tileNodes.
  • createComputePipelineTasks(leaf, { name }) derives ${name}CompileTask / ${name}ExecuteTask so custom pipelines don't collide with the defaults in graph.inspect(); test added.
  • elevationFn.displayName("elevationFn"); stale packHalf2x16 doc on terrainFieldStageTask rewritten for the RGBA pack.
  • "sideEffects": false on three/react/work (audited for import-time side effects; none required). CJS build left as is.
  • Docs: new "Elevation textures" section, createComputePipelineTasks docs, changelog; specs architecture.md, naming-conventions.md, terrain-data-model.md updated; docs components updated to new names.

Verification

  • typecheck, lint (0 warnings; fixed the one pre-existing), vitest three 71/71, work 70/70, react 4/4, pnpm -r build succeeds and three's dist export list no longer contains the removed symbols.
  • Bugbot adversarial review (leftover imports across react/docs/benchmarks, TerrainTasks type vs keys, sideEffects safety, alias correctness): no findings. Grep across packages/react, apps/docs, READMEs finds no stale references.

Merge notes

Made with Cursor

- packages/three/src/index.ts: replace `export * from ./quadtree` / `./tasks`
  with explicit named exports; drop leaked LOD internals (update, createState,
  beginUpdate, allocLeafSet, resetLeafSet, allocSeamTable, resetSeamTable,
  buildSeams2to1, SeamTable, buildLeafIndex, createSpatialIndex, U32_EMPTY,
  runTileBoundsReduction)
- remove dead NodeFlags / isLive / NodeStore.flags / NodeStore.roots
- rename tsl/heightmap.ts -> tsl/elevationTexture.ts: ElevationTexture,
  sampleElevationTextureMeters (deprecated aliases kept for one release)
- rename createTerrainFieldTextureTask -> createTerrainFieldStorageTask
  (deprecated alias kept); terrainTasks keys createTileNodes -> tileNodes,
  createTerrainFieldTexture -> createTerrainFieldStorage
- createComputePipelineTasks(leaf, { name }) derives
  ${name}CompileTask / ${name}ExecuteTask display names
- elevationFn.displayName("elevationFn"); fix stale terrainFieldStageTask doc
- "sideEffects": false on three / react / work
- docs: changelog entry, elevation-texture + custom compute stage sections,
  spec updates; bean hello-terrain-b5k2 completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant