fix(forms): make standalone forms importable as documented#2173
fix(forms): make standalone forms importable as documented#2173masonjames wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 19201b6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
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
./astroentrypoint remains the block-component registry for Portable Text, while./uiis the standalone component entrypoint. That's a sensible separation. - Package exports: The new
./uientry points at./src/astro/ui.ts, which is covered by the package's"files": ["src"]. - Barrel file:
src/astro/ui.tsis a single-line value re-export; no type-only exports to split out, and.astroextension is required for Astro component imports. - Test:
ui-export.test.tsusesimport.meta.resolveto verify the documented entrypoint resolves. This is pragmatic because Node/Vitest can't directly execute.astrofiles; it does catch the originalERR_PACKAGE_PATH_NOT_EXPORTEDregression. - 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/astrois already excluded from this package'stsconfig.json(so the new file follows existing Astro-in-plugins type-checking practice).
Everything looks clean. LGTM.
What does this PR do?
Makes the standalone forms component importable through the public entrypoint already documented in
Form.astro:The package export map did not expose
./ui, so consumers receivedERR_PACKAGE_PATH_NOT_EXPORTEDbefore Astro could load the component. This adds the missing entrypoint, exports the namedFormcomponent, and includes a regression test for package resolution.No linked issue; this was found while smoke-testing the forms plugin locally.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
No visual changes.
Validated with:
pnpm buildpnpm typecheckpnpm lintpnpm --filter @emdash-cms/plugin-forms test— 19 tests passedastro checkandastro buildwith a temporary consumer page importing{ Form }from@emdash-cms/plugin-forms/ui