Skip to content

feat: load an arbitrary build in the playground via ?package=#93

Open
StephenTangCook wants to merge 4 commits into
mainfrom
claude/xenodochial-murdock-33b896
Open

feat: load an arbitrary build in the playground via ?package=#93
StephenTangCook wants to merge 4 commits into
mainfrom
claude/xenodochial-murdock-33b896

Conversation

@StephenTangCook

Copy link
Copy Markdown
Collaborator

What

The playground now accepts an optional ?package= query param that overrides the bundled local source and renders a different build of the library instead — loaded at runtime via esm.sh.

  • ?package=1.1.0 → a released version
  • ?package=<full ESM url> → used as-is (e.g. an esm.sh /pr/ preview build)

The PR-preview bot comment (playground-comment.yml) now links straight to the playground with the PR's build pre-loaded, so a reviewer gets a one-click live render of the exact PR — no install, no field to paste into.

Why

Previously the comment pointed reviewers at a "Library package field / Load build" UI that didn't exist. This wires up the real capability and makes the preview link self-contained.

How it works

  • A bare version resolves to https://esm.sh/slack-blocks-to-jsx@<version>; a full URL is passed through. Both get ?deps=react@18.3.1,react-dom@18.3.1 appended.
  • The override build renders in its own React root (React + ReactDOM loaded from esm.sh, all pinned to 18.3.1 so esm.sh serves a single shared instance — avoids "invalid hook call" from two Reacts). It's fully isolated from the playground's bundled React.
  • Default behavior (local ../src with HMR) is unchanged when no param is present.
  • esm.sh's /pr/<owner>/<repo>/<pkg>@<pr-number> endpoint takes the PR number directly and resolves it to that PR's pkg.pr.new build — verified against this repo.

Reviewer notes

  • The override build's JS is swapped; styling still comes from local ../src/style.css (class names are stable), so a PR that changes CSS won't be fully reflected. Out of scope here.
  • Unrelated pre-existing breakage: pnpm playground:build (tsc -b) currently fails with ~32 errors from a stale @types/react@17 bump (dependabot chore(deps-dev): bump @types/react from 17.0.88 to 17.0.93 #81), present before this change. Vite bundling is clean.

Add an optional `?package=` query param to the playground that overrides
the bundled local source with a published or preview build, loaded at
runtime via esm.sh. Accepts a version string (`1.1.0`) or a full ESM URL.
The override renders in its own React root (react/react-dom pinned to
18.3.1 so esm.sh shares one instance), keeping it isolated from the
playground's React.

The PR-preview comment now links straight to the playground with the
PR's pkg.pr.new build pre-loaded via esm.sh's /pr/ endpoint, so reviewers
get a one-click live render of the exact PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for the PR, @StephenTangCook!

You can try these changes live, before any release — no install needed.
Once the preview build finishes (see the pkg-pr-new bot comment), open the playground and load this PR's build:

🛝 Playground: https://slack-block-to-jsx-playground.vercel.app/
📦 This PR's build: https://pkg.pr.new/slack-blocks-to-jsx@93

Paste the build URL into the Library package field (or hit the pkg.pr #93 preset) and click Load build — your blocks render against this exact PR. 🎉

@pkg-pr-new

pkg-pr-new Bot commented Jun 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/slack-blocks-to-jsx@93

commit: 3302e8e

StephenTangCook and others added 3 commits June 29, 2026 11:05
Add a "Library package" text field, a "Load build" button, a "Use local
build" reset, and a ?pr-driven "pkg.pr #N" preset to the toolbar. The field
accepts a version, a pkg.pr.new build URL (routed through esm.sh), or any
ESM URL; the active build mirrors to ?package= so the URL stays shareable.

The PR-preview comment now links with ?package=<build>&pr=<n> and keeps the
field/preset/Load-build instructions, which are now accurate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a heading to the comment body and rename the workflow to match, so the
auto-posted PR comment is identifiable (the bot author stays github-actions).

Co-Authored-By: Claude Opus 4.8 <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