Skip to content

Add environment-safe chart barrels - #8

Open
tannerlinsley wants to merge 1 commit into
mainfrom
taren/portable-barrels
Open

Add environment-safe chart barrels#8
tannerlinsley wants to merge 1 commit into
mainfrom
taren/portable-barrels

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

  • add @tanstack/charts/portable for common authoring, runtime, scene, and static SVG values without browser hosts or adapters
  • add @tanstack/charts/types for portable public contracts
  • isolate DOM host and renderer declarations internally while preserving every existing root export
  • add packed declaration and bundle-boundary gates plus public documentation

Compatibility

The existing @tanstack/charts runtime and type API is unchanged. Both new subpaths are additive, and no platform-specific export conditions are introduced.

The packed portable barrel is 55.26 kB minified / 17.04 kB gzip. Granular subpaths remain available for bundle-sensitive consumers.

Validation

  • tsc --noEmit -p tsconfig.json
  • vitest run — 464 files, 3,002 tests
  • node scripts/check-packed-consumers.mjs
  • node scripts/check-framework-adapters.mjs — 7 adapters
  • node scripts/check-docs.mjs
  • Prettier and git diff --check

Summary by CodeRabbit

  • New Features

    • Added portable package imports for chart APIs that avoid browser-specific dependencies.
    • Added a dedicated types-only entry point for platform-neutral TypeScript contracts.
    • Preserved browser-oriented root exports, including DOM host and renderer types.
  • Documentation

    • Updated installation and reference guides with import-path guidance and capability boundaries.
  • Bug Fixes

    • Improved package validation to verify portable bundles and declarations work in non-DOM environments.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e0a991e3-687a-4f6a-b633-c9134c8f3d06

📥 Commits

Reviewing files that changed from the base of the PR and between fa9a61b and ed7bcde.

📒 Files selected for processing (23)
  • API-FRICTION.md
  • docs/installation.md
  • docs/reference/index.md
  • docs/reference/types.md
  • packages/charts-core/docs/installation.md
  • packages/charts-core/docs/reference/index.md
  • packages/charts-core/docs/reference/types.md
  • packages/charts-core/package.json
  • packages/charts-core/src/adapter-renderer.ts
  • packages/charts-core/src/adapter.ts
  • packages/charts-core/src/canvas.test.ts
  • packages/charts-core/src/canvas.ts
  • packages/charts-core/src/dom-types.ts
  • packages/charts-core/src/dom.ts
  • packages/charts-core/src/exports.test.ts
  • packages/charts-core/src/index.ts
  • packages/charts-core/src/portable-types.ts
  • packages/charts-core/src/portable.ts
  • packages/charts-core/src/renderer.test.ts
  • packages/charts-core/src/renderer.ts
  • packages/charts-core/src/svg-surface.ts
  • packages/charts-core/src/types.ts
  • scripts/check-packed-consumers.mjs
💤 Files with no reviewable changes (1)
  • packages/charts-core/src/types.ts

📝 Walkthrough

Walkthrough

The package adds portable and types entry points, separates DOM-specific contracts from portable types, preserves browser-oriented root exports, and adds packed declaration and bundle-boundary validation.

Changes

Portable package boundaries

Layer / File(s) Summary
DOM contract separation
packages/charts-core/src/dom-types.ts, packages/charts-core/src/types.ts, packages/charts-core/src/{adapter,adapter-renderer,canvas,dom,renderer,svg-surface}.ts, packages/charts-core/src/index.ts, packages/charts-core/src/*test.ts
DOM host, renderer, surface, and tooltip contracts move to dom-types.ts. Root exports retain these contracts, while portable type exports use portable-types.ts.
Portable entry points
packages/charts-core/src/{portable,portable-types,index,exports.test}.ts, packages/charts-core/package.json
The package adds portable runtime and type-only barrels and publishes both subpaths. Export tests cover the new boundaries.
Packed consumer validation
scripts/check-packed-consumers.mjs
Packed checks validate portable declarations, type-only resolution, per-entry build settings, and exclusion of browser-host modules from portable bundles.
Boundary documentation
docs/**, packages/charts-core/docs/**, API-FRICTION.md
Documentation describes root, portable, and type-only import paths. The API friction record marks the browser-host boundary finding as resolved.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PortableConsumer
  participant PortableEntry
  participant PackedConsumerChecks
  PortableConsumer->>PortableEntry: Import portable runtime and types
  PackedConsumerChecks->>PortableEntry: Resolve packed declarations and bundle entry
  PackedConsumerChecks->>PackedConsumerChecks: Reject browser-host modules in portable output
Loading

Possibly related PRs

  • TanStack/charts#5: The package export and packed-consumer changes extend the release and artifact validation introduced in that PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding environment-safe portable and types chart barrels.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch taren/portable-barrels

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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