Skip to content

fix(ts-plugins): prune inlined WebGL constant imports - #43

Draft
ibgreen wants to merge 1 commit into
masterfrom
codex/prune-inlined-webgl-imports
Draft

fix(ts-plugins): prune inlined WebGL constant imports#43
ibgreen wants to merge 1 commit into
masterfrom
codex/prune-inlined-webgl-imports

Conversation

@ibgreen

@ibgreen ibgreen commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Supports visgl/luma.gl#2852.

Goals

  • Remove WebGL constant imports after every runtime use of a binding has been inlined.
  • Preserve imports that still have direct, dynamic, or other live runtime uses.
  • Avoid leaving type-only neighbors in generated JavaScript when an import declaration is updated.

Changes

  • Tracks runtime identifier uses after replacing static GL.* and gl.* accesses.
  • Prunes dead bindings from known luma.gl constant-module imports, removing the declaration when no runtime bindings remain.
  • Ignores type nodes so enum-member return types and explicit type imports do not keep runtime imports alive.
  • Adds coverage for full removal, mixed imports, dynamic access, direct access, and mixed enum/type annotations.

Verification

  • corepack yarn@1.22.19 lint — passed (187 existing warnings, 0 errors; Prettier and lockfile checks passed)
  • corepack yarn@1.22.19 build — passed
  • Focused transformer tests — 8 passed
  • corepack yarn@1.22.19 test — 34 passed
  • Push hook — changed-file lint and all 34 Node tests passed
  • luma.gl integration — full yarn build passed with this transformer; normal WebGL modules no longer emit constant imports, while the deliberate GL as GLEnum debug import remains.
  • On luma.gl's WebGL debug-split branch, generated @luma.gl/webgl CommonJS root size changed from 268.8 KB to 266.6 KB.

Notes

The first commit attempt hit the repository's unpinned Corepack default and invoked Yarn 4 against a Yarn 1 lockfile. The commit was created with --no-verify only after the pinned Yarn 1 lint/build/test gates passed; the push hook subsequently ran successfully.

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