Skip to content

feat(core): forward portableTextBlocks and fieldWidgets for standard/sandboxed plugins#1484

Open
swissky wants to merge 1 commit into
emdash-cms:mainfrom
swissky:forward-plugin-portable-text-blocks
Open

feat(core): forward portableTextBlocks and fieldWidgets for standard/sandboxed plugins#1484
swissky wants to merge 1 commit into
emdash-cms:mainfrom
swissky:forward-plugin-portable-text-blocks

Conversation

@swissky

@swissky swissky commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Standard- and sandboxed-format plugins can declare portableTextBlocks and fieldWidgets, but adaptSandboxEntry only copied adminPages / adminWidgets onto the resolved admin config — so those two declarative fields were silently dropped for every non-native plugin. The admin editor already reads them from the manifest (slash-menu entries + Block Kit forms), so the data simply never arrived: a non-native plugin could never contribute a custom Portable Text block or field widget.

This forwards both fields the same way adminPages / adminWidgets already flow:

  • plugins/adapt-sandbox-entry.ts — copy descriptor.portableTextBlocks / fieldWidgets onto admin.
  • astro/integration/runtime.tsPluginDescriptor carries the two fields (typed via the existing PortableTextBlockConfig / FieldWidgetConfig).
  • astro/integration/virtual-modules.ts — the in-process adaptSandboxEntry(...) call and the sandboxed-entry codegen pass them through.
  • emdash-runtime.tsSandboxedPluginEntry and the marketplace manifest cache carry them; the three adaptSandboxEntry call sites forward them; the sandboxed-entry and marketplace manifest loops emit them (this also resolves the pre-existing TODO in the sandboxed-plugin loop).

The site-side render component (componentsEntry) stays native-only — out of scope here.

Closes #1483

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Cursor + Claude Opus 4.8

Screenshots / test output

```
$ pnpm --filter emdash typecheck # tsgo --noEmit — clean
$ pnpm --filter emdash exec vitest run tests/unit/plugins/adapt-sandbox-entry.test.ts
Test Files 1 passed (1)
Tests 28 passed (28) # +3 new: portable text blocks, field widgets, omitted-config
```

oxlint + prettier --check clean on the changed files. No admin UI strings were added (i18n N/A).

…sandboxed plugins

Standard- and sandboxed-format plugins could declare adminPages and
adminWidgets, but their declarative portableTextBlocks and fieldWidgets were
dropped in adaptSandboxEntry, so only native-format plugins surfaced them.
The admin editor already reads both from the manifest (slash-menu entries +
Block Kit forms), so the data simply never arrived for non-native plugins.

Forward them like the existing admin config:
- adaptSandboxEntry copies descriptor.portableTextBlocks / fieldWidgets onto admin
- PluginDescriptor and SandboxedPluginEntry carry the fields
- the in-process and codegen plugin builders pass them through
- the sandboxed-entry and marketplace manifest loops emit them

The site-side render component (componentsEntry) remains native-only. Resolves
the pre-existing TODO in the sandboxed-plugin manifest loop.
@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9a59417

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/admin Minor
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
create-emdash Minor
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added review/needs-review No maintainer or bot review yet area/core size/M labels Jun 15, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1484

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1484

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@1484

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1484

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1484

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@1484

emdash

npm i https://pkg.pr.new/emdash@1484

create-emdash

npm i https://pkg.pr.new/create-emdash@1484

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1484

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@1484

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@1484

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@1484

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@1484

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@1484

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1484

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1484

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1484

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1484

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1484

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1484

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@1484

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1484

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1484

commit: 9a59417

@github-actions

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

@ascorbic ascorbic added bot:review Trigger an emdashbot code review on this PR and removed bot:review Trigger an emdashbot code review on this PR labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core bot:review Trigger an emdashbot code review on this PR overlap review/needs-review No maintainer or bot review yet size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standard/sandboxed plugins can't contribute Portable Text blocks or field widgets

2 participants