Skip to content

feat: migrate to pnpm monorepo with tsdown and fix all package variants#362

Closed
alexandernanberg wants to merge 23 commits intodimforge:masterfrom
alexandernanberg:alna/pkg-fixes
Closed

feat: migrate to pnpm monorepo with tsdown and fix all package variants#362
alexandernanberg wants to merge 23 commits intodimforge:masterfrom
alexandernanberg:alna/pkg-fixes

Conversation

@alexandernanberg
Copy link
Contributor

No description provided.

alexandernanberg and others added 23 commits January 31, 2026 06:47
- Migrate from npm to pnpm workspaces monorepo structure
- Replace webpack with Vite for testbeds
- Replace rollup with tsdown for package builds
- Fix SIMD variants by using bundler aliasing to redirect ./raw to ./raw-simd
- Add explicit WASM URLs in init files for fetch-based variants
- Copy WASM files to dist during build via onSuccess hooks

All 4 variants (default, simd, compat, compat-simd) now work correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migrate from nalgebra to glam types as required by Rapier 0.32:
- Replace Isometry<Real> with Pose
- Replace Point<Real> with Vector for positions
- Update all return-by-reference APIs to return-by-value
- Remove unused nalgebra dependency (now pure glam)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace bind2(...).call2(...) with direct call4(...) calls in
filter_contact_pair and filter_intersection_pair. This avoids
creating intermediate bound function objects during collision
detection callbacks, reducing GC pressure in hot paths.

Requires js-sys 0.3.85+ which adds call4 through call9 methods.

Updated dependencies:
- js-sys: 0.3.77 → 0.3.85
- wasm-bindgen: 0.2.100 → 0.2.108

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Upgrades wasm-pack from 0.12.1 to 0.14.0 which includes wasm-opt v112.
Adds pnpm.onlyBuiltDependencies config to allow wasm-pack postinstall.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add [lints.rust] config to declare dim2/dim3 as valid cfg values
- Remove unused imports: Vector, Real, RawRotation (conditional)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add optional target parameter to translation(), rotation(), linvel(),
angvel() methods on RigidBody and Collider. When provided, writes
directly into the target object to avoid allocations in tight loops.

Includes Rust-side support for Collider translation/rotation getters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Includes scenarios for:
- Simulation (world.step with stacked bodies)
- Lifecycle (body creation/destruction)
- Queries (ray casting, point projection)
- Getters (allocation vs zero-allocation comparison)

Run with: pnpm bench, pnpm bench:2d, pnpm bench:quick

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Upgrade pixi.js from 6.5.10 to 8.15.0
- Upgrade pixi-viewport from 4.38.0 to 6.0.3
- Convert to async initialization pattern (Graphics.create(), Testbed.create())
- Update Graphics API for v8:
  - beginFill/endFill -> fill()
  - drawRect/drawCircle -> rect/circle
  - lineStyle -> stroke()
  - PIXI.utils.rgb2hex -> Color.toNumber()
  - renderer.view -> renderer.canvas
  - interaction -> events for Viewport
  - clone() -> clone(true) for deep cloning
- Fix debug renderer: batch lines by color to avoid
  pixi.js 8's stroke() re-stroking all accumulated paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Upgrade three.js from 0.146.0 to 0.182.0
- Update imports to use three/addons/ instead of three/examples/jsm/
- Fix raycaster.setFromCamera to use THREE.Vector2
- Fix PointLight: set decay=0 to restore non-physically-correct
  lighting (Three.js r155+ defaults decay to 2, making lights very dim)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Upgrade tsdown from 0.11.0 to 0.20.1
- Update package exports to use .mjs/.d.mts extensions
  (tsdown 0.20.1 outputs .mjs for ESM by default)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add `undefined!` in free() methods to satisfy strict null checks
- Add `!` assertions for VectorOps.fromRaw() calls that always succeed
- Add `?? null` for methods returning null but WASM returns undefined
- Add `?? 0` for optional filterFlags parameters
- Change Coarena<T> to use Array<T | null> for sparse storage
- Update getter methods (getRigidBody, etc.) to return | null
- Remove ray_cast_vehicle_controller from 2D (no WASM binding)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enable zero-allocation contact iteration by allowing callers to pass
a reusable vector object to TempContactManifold methods instead of
allocating new objects on each call.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of creating temporary RawVector objects for ray origin and
direction, pass the float components directly to WASM. This eliminates
4 WASM boundary crossings per ray cast (2 allocations + 2 frees).

Benchmark results (fork before → after):

3D:
- castRay: 1.7µs → 1.2µs (29% faster)
- castRayAndGetNormal: 2.6µs → 1.9µs (27% faster)

2D:
- castRayAndGetNormal: 2.4µs → 1.9µs (21% faster)

Compared to official @dimforge package:
- castRay: 43% faster
- castRayAndGetNormal: 42% faster

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Simplify benchmark table format (Fork vs Official)
- Add ray casting benchmark (35% faster)
- Update baseline with current results

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add code examples showing zero-allocation getter pattern and explain
why the fork is faster (latest Rapier, optimized WASM boundary).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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