Skip to content

Split React bindings into @sigmacomputing/plugin-react package#61

Draft
Pearce-Ropion wants to merge 4 commits into
mainfrom
claude/bold-meitner-QS7GS
Draft

Split React bindings into @sigmacomputing/plugin-react package#61
Pearce-Ropion wants to merge 4 commits into
mainfrom
claude/bold-meitner-QS7GS

Conversation

@Pearce-Ropion
Copy link
Copy Markdown
Collaborator

Summary

  • Add a new packages/plugin-sdk-react workspace (npm name @sigmacomputing/plugin-react) that houses SigmaClientProvider, PluginContext, and every React hook (usePlugin, useConfig, useElementColumns, useElementData, usePaginatedElementData, useVariable, useUrlParameter, useInteraction, useActionTrigger, useActionEffect, usePluginStyle, useEditorPanelConfig, useLoadingState).
  • The new package depends on @sigmacomputing/plugin (workspace) and keeps react as a peer dependency. The framework-agnostic @sigmacomputing/plugin no longer declares the react peer dep and no longer re-exports anything from ./react.
  • @sigmacomputing/plugin now also exports initialize from its public entry — it was already documented as public API in the README but only reachable via an internal path, and the moved hook tests need it.
  • Existing hook tests are moved over and updated to import from @sigmacomputing/plugin / sibling files; behavior is byte-identical aside from import paths. The small internal deepEqual helper used by useEditorPanelConfig is copied into the new package rather than re-exported, since it isn't part of the public surface area.
  • Naming follows the existing convention of dropping -sdk from npm names (directory plugin-sdk → npm @sigmacomputing/plugin, directory plugin-sdk-react → npm @sigmacomputing/plugin-react). Happy to switch to @sigmacomputing/plugin-sdk-react if you'd rather match the directory name.

Migration for consumers: replace

import { SigmaClientProvider, useConfig } from '@sigmacomputing/plugin';

with

import { SigmaClientProvider, useConfig } from '@sigmacomputing/plugin-react';

Test plan

  • yarn lint — clean
  • yarn types — clean (turbo runs ^build for both packages first)
  • yarn build — both packages build; @sigmacomputing/plugin-react ESM/CJS/UMD bundles correctly externalize react and @sigmacomputing/plugin
  • yarn syncpack:lint — clean
  • yarn test — could not run in this environment (Playwright Chromium download blocked by network policy and no system Chromium available); needs to be verified in CI. The moved hooks.test.tsx is byte-identical to the original except for import paths.

https://claude.ai/code/session_01AZefsCe7wagmamsoVfekuL


Generated by Claude Code

claude added 4 commits May 22, 2026 00:18
Move the SigmaClientProvider context and all React hooks (usePlugin,
useConfig, useElementColumns, useElementData, useVariable,
useUrlParameter, useInteraction, useActionTrigger, useActionEffect,
usePluginStyle, useEditorPanelConfig, useLoadingState,
usePaginatedElementData) out of @sigmacomputing/plugin into a new
packages/plugin-sdk-react workspace. The new package depends on
@sigmacomputing/plugin and keeps react as a peer dependency. The
framework-agnostic plugin-sdk no longer carries a react peer dep, and
its public API now also exports initialize (which the moved test relies
on and which is already documented as public).

https://claude.ai/code/session_01AZefsCe7wagmamsoVfekuL
Align the npm name with the directory name (packages/plugin-sdk-react)
rather than dropping the -sdk suffix. Also updates the UMD bundle
filename and global to match.

https://claude.ai/code/session_01AZefsCe7wagmamsoVfekuL
* Replace the custom deepEqual helper with the dequal package
  (dequal/lite is bundled into all output formats via deps.alwaysBundle
  so consumers and UMD users do not need to provide it)
* Set the UMD global name to SigmaPluginReact
* Move __VERSION__ injection into tsdown.base.ts / vitest.base.ts since
  every workspace package shares the root version; per-package configs
  now just re-export the base
* Replace workspace:^ with the actual semver range so npm publish
  produces a usable tarball, and teach scripts/bump-version.ts to keep
  internal @sigmacomputing/* dep ranges in sync on every bump

https://claude.ai/code/session_01AZefsCe7wagmamsoVfekuL
Split the plugin-sdk-react tsdown config into two builds: ESM + CJS
keep dequal external (consumers install it via npm and deduping
happens normally), while UMD bundles it so the standalone bundle only
needs react and @sigmacomputing/plugin as globals.

https://claude.ai/code/session_01AZefsCe7wagmamsoVfekuL
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.

2 participants