Skip to content

fix(forms): make standalone forms importable as documented#2173

Open
masonjames wants to merge 3 commits into
emdash-cms:mainfrom
masonjames:codex/export-forms-ui
Open

fix(forms): make standalone forms importable as documented#2173
masonjames wants to merge 3 commits into
emdash-cms:mainfrom
masonjames:codex/export-forms-ui

Conversation

@masonjames

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes the standalone forms component importable through the public entrypoint already documented in Form.astro:

import { Form } from "@emdash-cms/plugin-forms/ui";

The package export map did not expose ./ui, so consumers received ERR_PACKAGE_PATH_NOT_EXPORTED before Astro could load the component. This adds the missing entrypoint, exports the named Form component, and includes a regression test for package resolution.

No linked issue; this was found while smoke-testing the forms plugin locally.

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 (not applicable: no admin UI strings changed)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: not applicable — this is a bug fix

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: OpenAI Codex (GPT-5)

Screenshots / test output

No visual changes.

Validated with:

  • pnpm build
  • pnpm typecheck
  • pnpm lint
  • pnpm --filter @emdash-cms/plugin-forms test — 19 tests passed
  • Cloudflare demo astro check and astro build with a temporary consumer page importing { Form } from @emdash-cms/plugin-forms/ui

@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 19201b6

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

This PR includes changesets to release 5 packages
Name Type
@emdash-cms/plugin-forms Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site 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

@masonjames
masonjames marked this pull request as ready for review July 21, 2026 13:19
@github-actions github-actions Bot added area/plugins size/S review/needs-review No maintainer or bot review yet labels Jul 21, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

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

@emdash-cms/plugin-types

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

@emdash-cms/registry-client

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

@emdash-cms/registry-lexicons

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

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@2173

@emdash-cms/sandbox-workerd

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: 19201b6

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a focused, correct bug fix: the Form.astro component already documented import { Form } from "@emdash-cms/plugin-forms/ui", but the package export map only exposed ./astro, ./client, ./styles, etc., so consumers hit ERR_PACKAGE_PATH_NOT_EXPORTED. The PR adds the missing ./ui entry, adds a tiny barrel file that re-exports the default Form Astro component as a named export, adds a regression test, and includes a well-written changeset.

I checked:

  • Approach: The change is exactly the right shape — it makes a documented path resolvable without altering behavior or adding a new unsolicited feature. The ./astro entrypoint remains the block-component registry for Portable Text, while ./ui is the standalone component entrypoint. That's a sensible separation.
  • Package exports: The new ./ui entry points at ./src/astro/ui.ts, which is covered by the package's "files": ["src"].
  • Barrel file: src/astro/ui.ts is a single-line value re-export; no type-only exports to split out, and .astro extension is required for Astro component imports.
  • Test: ui-export.test.ts uses import.meta.resolve to verify the documented entrypoint resolves. This is pragmatic because Node/Vitest can't directly execute .astro files; it does catch the original ERR_PACKAGE_PATH_NOT_EXPORTED regression.
  • Changeset: Present, user-facing, and avoids internal file names.
  • Conventions: No admin UI strings, no SQL, no new logged-out routes/queries, no comment issues, and src/astro is already excluded from this package's tsconfig.json (so the new file follows existing Astro-in-plugins type-checking practice).

Everything looks clean. LGTM.

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Jul 21, 2026
Comment thread packages/plugins/forms/tests/ui-export.test.ts Outdated
@github-actions github-actions Bot added size/XS review/needs-rereview Author pushed changes since the last review and removed size/S review/approved Approved; no new commits since labels Jul 22, 2026
@masonjames masonjames added review/ready-for-maintainer and removed review/needs-rereview Author pushed changes since the last review labels Jul 22, 2026
@github-actions github-actions Bot added the review/needs-rereview Author pushed changes since the last review label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants