Skip to content

Move 3D code to separate @opentui/three package#793

Open
remorses wants to merge 28 commits intoanomalyco:mainfrom
remorses:move-3d-to-separate-package
Open

Move 3D code to separate @opentui/three package#793
remorses wants to merge 28 commits intoanomalyco:mainfrom
remorses:move-3d-to-separate-package

Conversation

@remorses
Copy link
Copy Markdown
Contributor

@remorses remorses commented Mar 8, 2026

Extracts packages/core/src/3d/ into a standalone @opentui/three package at packages/three/.

  • New package packages/three/ with dedicated build/publish scripts and tsconfig
  • Examples remain in core on purpose so there is a single example selector and all demos live in one place (packages/core/src/examples/index.ts)
  • Examples now import 3D APIs from @opentui/three instead of core internal paths
  • Core exports cleaned up by removing src/3d.ts and the ./3d export
  • CI/release/publish flows updated to build, validate, preview, and publish @opentui/three
  • Packaging fix for core dist metadata so preview/release packing resolves workspace dependencies correctly

remorses and others added 20 commits December 23, 2025 23:51
- Move examples back from packages/3d/examples to packages/core/src/examples
- Update imports to use @opentui/3d instead of relative ../src paths
- Add @opentui/3d as workspace dev dependency in core
- Update CI to build 3d package before core
- Update root build/publish scripts to include 3d package
- Remove 3d.ts re-export and 3d entry point from core build
Resolved conflicts:
- CI workflow: took upstream's matrix build, added 3d build step
- package.json: kept 3d in build/publish order
- core/package.json: upstream versions, removed 3d optional deps (now in 3d pkg)
- golden-star-demo: merged import styles
- texture-loading-demo: took upstream's ThreeRenderable rewrite, fixed imports
- ThreeRenderable.ts: new file from upstream, fixed imports for 3d package
- draggable-three-demo: new example from upstream, fixed imports
- Benchmark files: kept in core (not 3d)
- bun.lock: regenerated
- Fix repository URL (sst/opentui -> anomalyco/opentui)
- Bump version to 0.1.86 to match core
- Remove jsx from tsconfig (not needed for 3D package)
- Fix tsconfig.build.json: rootDir src not ., remove redundant moduleResolution/baseUrl
- Fix dist package.json: correct types path, remove stale optionalDependencies field
Publish preview was failing because @opentui/core dist/package.json kept a workspace devDependency (@opentui/three), which bun cannot resolve when packing from dist in CI. The core build script now normalizes workspace devDependencies to the package version when generating dist metadata, matching how other local workspace links are materialized for publish artifacts.

This also finishes @opentui/three release integration by updating release/pre-publish scripts, aligns three's build script with existing package build conventions, pins bun-webgpu back to 0.1.5, adds the missing jimp dependency used by three sources, and runs three CI builds in strict mode (build --ci).
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 8, 2026

@opentui/core

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core@d6555ec

@opentui/react

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/react@d6555ec

@opentui/solid

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/solid@d6555ec

@opentui/three

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/three@d6555ec

@opentui/core-darwin-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-arm64@d6555ec

@opentui/core-darwin-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-x64@d6555ec

@opentui/core-linux-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-arm64@d6555ec

@opentui/core-linux-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-x64@d6555ec

@opentui/core-win32-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-arm64@d6555ec

@opentui/core-win32-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-x64@d6555ec

commit: d6555ec

remorses added 2 commits March 8, 2026 18:05
The three package is now published from the root publish flow, so CI workflows must build, package, and validate it end-to-end. This updates preview and release workflows to treat three the same way as react/solid where appropriate.

Changes:
- pkg-pr-new: trigger on packages/three changes, build three in CI mode, and publish three dist in preview
- build-native: build three and include three-dist in npm-packages artifact
- npm-latest-release: extract three-dist from artifacts and include @opentui/three in dry-run pack validation
- npm-release (snapshot): build three before publish
The branch updates @opentui/three to bun-webgpu 0.1.5. build-examples had cache probe paths pinned to 0.1.4, which caused misleading warnings during release workflows. This updates the probe paths to 0.1.5 to keep diagnostics accurate.
@remorses remorses marked this pull request as ready for review March 8, 2026 17:16
Copilot AI review requested due to automatic review settings March 8, 2026 17:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extracts the CLI/WebGPU/three.js “3D” functionality out of @opentui/core into a new standalone workspace package (packages/three, published as @opentui/three), and updates repo scripts/CI plus core examples to consume the new package.

Changes:

  • Adds new @opentui/three package with its own build/publish scripts, tsconfigs, shaders, and animation/physics utilities.
  • Updates release + pre-publish tooling and CI workflows to build/validate/publish the new package alongside core/react/solid.
  • Removes core’s src/3d.ts re-export entrypoint and updates core examples to import 3D utilities from @opentui/three.

Reviewed changes

Copilot reviewed 35 out of 47 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/prepare-release.ts Bumps version for @opentui/three during release preparation.
scripts/pre-publish.ts Adds @opentui/three to pre-publish validation (dist exists, versions match, core dep version check).
packages/three/tsconfig.json New package TS config for development/typechecking.
packages/three/tsconfig.build.json New build TS config for emitting declarations into dist/.
packages/three/src/shaders/supersampling.wgsl Adds WGSL compute shader source for supersampling.
packages/three/src/physics/physics-interface.ts Introduces physics abstraction interfaces for adapters/effects.
packages/three/src/physics/RapierPhysicsAdapter.ts Adds Rapier-based adapter implementation for the physics interfaces.
packages/three/src/physics/PlanckPhysicsAdapter.ts Adds Planck-based adapter implementation for the physics interfaces.
packages/three/src/index.ts Package entrypoint re-exports (currently minimal).
packages/three/src/canvas.ts Switches imports to pull RGBA/OptimizedBuffer from @opentui/core.
packages/three/src/animation/SpriteParticleGenerator.ts Adds GPU-driven sprite particle generator implementation.
packages/three/src/animation/SpriteAnimator.ts Adds sprite animator + instancing management for sprite sheets.
packages/three/src/animation/PhysicsExplodingSpriteEffect.ts Adds physics-driven exploding sprite effect + manager.
packages/three/src/animation/ExplodingSpriteEffect.ts Adds GPU shader-based exploding sprite effect + manager.
packages/three/src/WGPURenderer.ts Switches imports to pull core rendering types/utilities from @opentui/core.
packages/three/src/ThreeRenderable.ts Switches Renderable/renderer/context dependencies to come from @opentui/core.
packages/three/src/TextureUtils.ts Adds texture loading + procedural texture helpers (Jimp-based).
packages/three/src/SpriteUtils.ts Adds helpers for loading sprites/sprite sheets from files.
packages/three/src/SpriteResourceManager.ts Adds sprite resource caching, mesh pooling, and instanced sprite management.
packages/three/scripts/publish.ts Adds publish script for @opentui/three dist.
packages/three/scripts/build.ts Adds build script that bundles JS + emits d.ts + writes dist package.json.
packages/three/package.json Defines new @opentui/three package metadata/deps/scripts.
packages/three/benchmark/renderer-benchmark.ts Updates benchmark to consume core + new package entrypoints.
packages/core/tsconfig.build.json Removes "three" types from core build types list.
packages/core/src/examples/texture-loading-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/static-sprite-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/sprite-particle-generator-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/sprite-animation-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/shader-cube-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/physx-rapier-2d-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/physx-planck-2d-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/lights-phong-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/index.ts Reorders example imports (no functional change beyond ordering).
packages/core/src/examples/golden-star-demo.ts Updates demo imports to consume from @opentui/three; consolidates core imports.
packages/core/src/examples/fractal-shader-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/examples/draggable-three-demo.ts Updates demo imports to consume from @opentui/three.
packages/core/src/3d.ts Removes core’s 3D re-export entrypoint.
packages/core/scripts/build.ts Removes 3D entrypoint from build and adjusts dist package.json devDependency processing.
packages/core/package.json Removes 3D export + optional deps; adds @opentui/three as devDependency.
package.json Updates monorepo build/publish scripts to include packages/three.
bun.lock Adds @opentui/three workspace entry; adjusts core deps accordingly.
.github/workflows/pkg-pr-new.yml Includes packages/three/** changes + builds/publishes three dist in pkg-pr-new flow.
.github/workflows/npm-release.yml Builds packages/three during release pipeline.
.github/workflows/npm-latest-release.yml Copies/validates three dist in latest release workflow.
.github/workflows/build-native.yml Builds and packages three dist artifacts alongside other packages.
.github/workflows/build-examples.yml Updates bun-webgpu cache checks from 0.1.4 to 0.1.5.
.github/workflows/build-core.yml Builds packages/three in core build workflow before running TS tests.
Comments suppressed due to low confidence (1)

packages/three/src/index.ts:4

  • @opentui/three’s public entrypoint (src/index.ts) doesn’t export several symbols that core examples now import from @opentui/three (e.g. SpriteAnimator, SpriteResourceManager, SpriteParticleGenerator, ExplosionManager, PhysicsExplosionManager, RapierPhysicsWorld, PlanckPhysicsWorld, SpriteUtils, and SuperSampleAlgorithm). This will cause runtime/TS errors like "export not found" when running the examples. Re-export these modules (or adjust the examples to import from the correct subpaths) to keep the package’s public API consistent with its usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@remorses remorses changed the title Move 3D code to separate @opentui/3d package Move 3D code to separate @opentui/three package Mar 8, 2026
Bring the branch up to date with the latest core, react, solid, docs, and plugin-slot work while preserving the 3D package extraction. Resolve the hot spots by keeping 3D examples on @opentui/three, retaining the new runtime-plugin/runtime-plugin-support entry points, and making the @opentui/core/3d runtime alias load from @opentui/three so the split still builds cleanly.
Keep the move-to-@opentui/three branch green after the upstream merge.

- fix the React slot error boundary so plugin subtree crashes fall back cleanly instead of leaking through the test runner
- wrap the React slot tests in act() and silence expected React error-boundary console noise so the suite matches CI behavior again
- update the React and Solid runtime-plugin-support fixtures to use @opentui/three as the external 3D runtime module, and load that module through lazy runtime loaders so declaration builds do not pull cross-package source files into core/react/solid builds
- keep the example and build-script formatting changes that Prettier was failing on
@remorses remorses requested a review from Adictya as a code owner March 12, 2026 15:43
@remorses remorses marked this pull request as draft March 12, 2026 16:59
Remove the React slot/error-boundary workaround layer and the formatting-only churn added in the follow-up CI fix commit.

Keep only the runtime-plugin wiring needed for the 3D split so external runtime-module support resolves the moved 3D package from @opentui/three without expanding the PR scope beyond the package separation work.
Apply the exact Prettier formatting expected by the workflow for the four moved 3D example imports and the three package build script, without changing the branch scope or behavior.
@remorses remorses marked this pull request as ready for review March 14, 2026 19:03
@kommander
Copy link
Copy Markdown
Collaborator

@remorses I'll be checking this next as soon as I got the first version of plugins in opencode

…-package

# Conflicts:
#	.github/workflows/pkg-pr-new.yml
#	bun.lock
#	packages/core/package.json
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.

3 participants