Move 3D code to separate @opentui/three package#793
Open
remorses wants to merge 28 commits intoanomalyco:mainfrom
Open
Move 3D code to separate @opentui/three package#793remorses wants to merge 28 commits intoanomalyco:mainfrom
remorses wants to merge 28 commits intoanomalyco:mainfrom
Conversation
- 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).
@opentui/core
@opentui/react
@opentui/solid
@opentui/three
@opentui/core-darwin-arm64
@opentui/core-darwin-x64
@opentui/core-linux-arm64
@opentui/core-linux-x64
@opentui/core-win32-arm64
@opentui/core-win32-x64
commit: |
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.
There was a problem hiding this comment.
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/threepackage 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.tsre-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, andSuperSampleAlgorithm). 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.
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
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.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracts
packages/core/src/3d/into a standalone@opentui/threepackage atpackages/three/.packages/three/with dedicated build/publish scripts and tsconfigpackages/core/src/examples/index.ts)@opentui/threeinstead of core internal pathssrc/3d.tsand the./3dexport@opentui/three