Installation
Install @dirtytalk/engine, structural and spatial with pnpm, plus module formats, TypeScript, runtime requirements and version pinning.
Each package is published to npm separately. Install @dirtytalk/engine on its own, or install structural or spatial together with engine.
Install
Engine
pnpm add @dirtytalk/engine
Structural
pnpm add @dirtytalk/structural @dirtytalk/engine
@dirtytalk/structural depends on @dirtytalk/engine (listed under dependencies). Installing engine explicitly is recommended when your code imports from it directly, for example to construct a DirtyChannel or a scheduler.
Spatial
pnpm add @dirtytalk/spatial @dirtytalk/engine
@dirtytalk/spatial depends on @dirtytalk/engine in the same way.
React entry point
React bindings for structural live in a subpath export:
import { useStructural } from '@dirtytalk/structural/react';
The core entry point @dirtytalk/structural has no React dependency. The react subpath requires react version 18 or later. It is declared as an optional peer dependency (react: >=18), so install it yourself if your project does not already have it:
pnpm add react
See Structural: React.
Module formats
All packages ship ESM and CommonJS builds with type declarations for each, selected through the exports map.
// ESM
import { DirtyChannel } from '@dirtytalk/engine';
// CommonJS
const { DirtyChannel } = require('@dirtytalk/engine');
The packages are marked sideEffects: false, so bundlers can tree-shake unused exports.
TypeScript
Types are bundled. No @types/* package is needed. For @dirtytalk/structural/react, resolve the subpath with a moduleResolution that honors exports (node16, nodenext or bundler). The package also provides a typesVersions entry for older resolution modes.
Runtime requirements
- The published packages do not declare an
enginesfield. The Node range in the repository root (^22.18.0 || >=24.11.0) applies to developing the monorepo, not to using the packages. - The code uses ES2022 features (private class fields) and
AggregateError, so the target runtime must support them. MicrotaskSchedulercallsqueueMicrotask.RAFSchedulerusesrequestAnimationFramewhenglobalThis.requestAnimationFrameis a function. Otherwise it falls back tosetTimeoutwith a 16 ms delay, so it also works in Node and test environments.SyncSchedulerandManualSchedulerneed no platform APIs.
See Schedulers.
Versioning
Warning: All packages are 0.x and pre-1.0. Breaking changes can ship in minor and patch releases.
-
Pin exact versions in
package.json(no^or~):pnpm add --save-exact @dirtytalk/engine -
Read the changelog before upgrading:
packages/engine/CHANGELOG.md,packages/structural/CHANGELOG.mdandpackages/spatial/CHANGELOG.mdin the repository. -
Keep
enginecompatible with theenginerange required bystructuralandspatial, so that a single copy of@dirtytalk/engineis installed.