Skip to content

Fix npm entrypoints for @fedify/astro#701

Open
dahlia wants to merge 6 commits intofedify-dev:2.1-maintenancefrom
dahlia:bugfix/astro
Open

Fix npm entrypoints for @fedify/astro#701
dahlia wants to merge 6 commits intofedify-dev:2.1-maintenancefrom
dahlia:bugfix/astro

Conversation

@dahlia
Copy link
Copy Markdown
Member

@dahlia dahlia commented Apr 19, 2026

Fixes #699

The published @fedify/astro package metadata pointed to dist/mod.js and dist/mod.d.ts, but the build was emitting dist/mod.mjs and dist/mod.d.mts. That left packages/astro/package.json advertising npm entrypoints that did not exist in the published package, which could break resolution in Node and Vite consumers.

This change restores the expected npm entrypoint contract by updating packages/astro/tsdown.config.ts so the ESM build emits .js and .d.ts outputs again. That brings the generated files back in line with the paths declared in packages/astro/package.json.

It also adds a regression test in packages/astro/src/package.test.ts that self-imports @fedify/astro and exercises the public API through both ESM import and CommonJS require. The CommonJS path is skipped under Deno so plain deno test in packages/astro/ still works without extra permissions.

CHANGES.md has also been updated.

Tests run:

  • deno test in packages/astro/
  • pnpm --filter @fedify/astro test

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 635ce85d-1c99-4394-a3e0-1b5e3c3deda0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@issues-auto-labeler issues-auto-labeler bot added breaking change Requires backward-incompatible change component/build Build system and packaging component/integration Web framework integration labels Apr 19, 2026
@dahlia dahlia self-assigned this Apr 19, 2026
@dahlia dahlia marked this pull request as ready for review April 19, 2026 15:08
@dahlia dahlia added type/bug Something isn't working integration/astro Astro integration (@fedify/astro) and removed breaking change Requires backward-incompatible change labels Apr 19, 2026
Restore the published npm entrypoint contract for @fedify/astro by
making tsdown emit dist/*.js and dist/*.d.ts files that match the
package metadata again.

Add a self-reference regression test that exercises the public API
through ESM import and CommonJS require so the packaged entrypoints are
validated the way consumers load them.

Update CHANGES.md with the packaging fix details.

Fixes fedify-dev#699

Assisted-by: Codex:gpt-5.4
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request restores the npm entrypoint contract for @fedify/astro by configuring tsdown to emit appropriate file extensions and adding a pretest build step. It also introduces a comprehensive test suite for ESM and CJS compatibility and corrects a typo in the commit skill documentation. Feedback focuses on maintaining strict TypeScript typing in tests by avoiding the use of as never for mocking, as it bypasses the repository's type-safety standards.

Comment thread packages/astro/src/package.test.ts Outdated
Comment thread packages/astro/src/package.test.ts Outdated
@dahlia
Copy link
Copy Markdown
Member Author

dahlia commented Apr 19, 2026

@codex review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes broken npm entrypoints for @fedify/astro by aligning emitted build artifacts with the paths declared in packages/astro/package.json, and adds coverage to prevent regressions.

Changes:

  • Configure tsdown to emit ESM outputs as dist/*.js + dist/*.d.ts (and CJS as *.cjs + *.d.cts) to match published package metadata.
  • Add a regression test that self-imports @fedify/astro via both ESM import() and CommonJS require() and exercises the public API.
  • Ensure tests build the package first by adding a pretest build step.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/astro/tsdown.config.ts Forces output extensions to match package.json module/types/exports entrypoints.
packages/astro/src/package.test.ts Adds runtime regression coverage for ESM import + CJS require self-resolution.
packages/astro/package.json Adds pretest to guarantee dist/ exists before running Node tests.
CHANGES.md Documents the entrypoint contract fix and links the issue/PR.
.agents/skills/commit/SKILL.md Fixes trailer name to Assisted-by in commit skill documentation.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Replace the test's `as never` shortcuts with explicit mock helper
functions and concrete `FederationFetchOptions` / `APIContext`
annotations.

This keeps the self-import regression test readable while preserving
plain `deno test` in *packages/astro/* and the existing Node packaging
checks.
@dahlia dahlia requested a review from Copilot April 19, 2026 15:19
@dahlia
Copy link
Copy Markdown
Member Author

dahlia commented Apr 19, 2026

@codex review

@dahlia
Copy link
Copy Markdown
Member Author

dahlia commented Apr 19, 2026

/gemini review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread packages/astro/src/package.test.ts
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request restores the npm entrypoint contract for the @fedify/astro package by ensuring the build process generates the correct file extensions for both ESM and CommonJS formats. Key changes include updating the tsdown configuration to emit .js/.d.ts for ESM and .cjs/.d.cts for CJS, adding a pretest build requirement, and implementing a new test suite to verify self-referencing imports. The PR also corrects a typo in the AI assistant trailer documentation. I have no feedback to provide.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dahlia added 2 commits April 20, 2026 01:19
Make the mock federation fetch methods await their callback results so
the test continues to return Promise<Response> while satisfying
Deno's require-await lint rule.

Assisted-by: Codex:gpt-5.4
Extend the Astro package regression test to assert that the JavaScript
and declaration entrypoints declared in package.json exist on disk.

This keeps the test aligned with the original packaging regression so
missing type outputs are caught before publication.
@dahlia dahlia requested a review from Copilot April 19, 2026 16:23
@dahlia
Copy link
Copy Markdown
Member Author

dahlia commented Apr 19, 2026

@codex review

@dahlia
Copy link
Copy Markdown
Member Author

dahlia commented Apr 19, 2026

/gemini review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request restores the npm entrypoint contract for the @fedify/astro package by ensuring the build process correctly emits .js, .cjs, .d.ts, and .d.cts files. It updates the tsdown configuration to handle these extensions explicitly and adds a new test suite to verify that both ESM and CJS entrypoints function correctly. Additionally, it fixes a typo in the commit skill documentation and adds a pretest script to the package. Feedback was provided regarding the new test file, specifically that the targets array construction could lead to false positive results if certain package.json fields are missing.

Comment thread packages/astro/src/package.test.ts Outdated
Make the Astro package test assert each package.json entrypoint
explicitly instead of relying on a cast to string[].

This prevents missing metadata fields from slipping through as false
positives while keeping the regression coverage focused on the
published package contract.
@dahlia dahlia requested a review from Copilot April 19, 2026 17:32
@dahlia
Copy link
Copy Markdown
Member Author

dahlia commented Apr 19, 2026

@codex review

@dahlia
Copy link
Copy Markdown
Member Author

dahlia commented Apr 19, 2026

/gemini review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request restores the npm entrypoint contract for @fedify/astro by configuring tsdown to emit explicit .js/.cjs and .d.ts/.d.cts extensions and adding a pretest build step. A new test suite verifies that both ESM and CJS imports work correctly and that all exported files exist. Additionally, a typo was corrected in the commit skill documentation. Review feedback identified several instances in the changelog where file paths used underscores for italics instead of the asterisks required by the repository's style guide.

Comment thread CHANGES.md
Comment thread CHANGES.md
@dahlia dahlia requested review from 2chanhaeng and sij411 April 19, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/build Build system and packaging component/integration Web framework integration integration/astro Astro integration (@fedify/astro) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@fedify/astro 2.1.5: package.json exports reference non-existent files

3 participants