Skip to content

feat: separate react hook into its own subpackage for tree-shaking #14

@jayf0x

Description

@jayf0x

Goal

Move the React components/hook to a separate module entry point so consumers who use only the canvas API don't bundle React-specific code.

Proposed API

```tsx
import { FluidImage, FluidText } from '@jayf0x/fluidity-js/react';
import { FluidSimulation } from '@jayf0x/fluidity-js';
```

Acceptance criteria

  • @jayf0x/fluidity-js/react entry point exports FluidText, FluidImage, useFluid
  • Main entry point (@jayf0x/fluidity-js) exports only non-React code
  • package.json exports map updated
  • Existing consumers: backward-compat shim or clear migration note in changelog
  • All 83+ tests pass
  • Bundle size of non-React consumers drops measurably

Note: This is a breaking change if the main entry point stops exporting React components. Coordinate with changelog/versioning.

Files likely touched: package.json, vite.config.ts, src/index.ts, src/globals.d.ts, src/index.d.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:dxBuild, DX, packagingeffort:5Major — architectural changetype:featureNew capability or prop

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions