Skip to content

docs: fix CommonJS send import#154

Open
vibhor-aggr wants to merge 1 commit into
koajs:masterfrom
vibhor-aggr:fix/readme-named-send-require
Open

docs: fix CommonJS send import#154
vibhor-aggr wants to merge 1 commit into
koajs:masterfrom
vibhor-aggr:fix/readme-named-send-require

Conversation

@vibhor-aggr

@vibhor-aggr vibhor-aggr commented Jul 11, 2026

Copy link
Copy Markdown

Fixes #152.

Summary

  • Updates the README CommonJS example to destructure the named send export from @koa/send.
  • Keeps the change limited to the stale usage snippet; runtime behavior is unchanged.

Validation

  • Static Node check confirmed src/index.ts re-exports named exports and the README no longer contains the stale const send = require("@koa/send") snippet.
  • npm run lint exited 0 with the existing complexity warning in src/send.ts.
  • npm test passed: 52 tests.
  • npm run build passed.
  • git diff --check passed.

Summary by Sourcery

Documentation:

  • Correct the CommonJS README example to use destructuring for the named send export from @koa/send.

Summary by CodeRabbit

  • Documentation
    • Updated the README example to demonstrate the current send import syntax.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cf111b8f-3d35-4e7a-9566-494762096fea

📥 Commits

Reviewing files that changed from the base of the PR and between 09657fc and d1f00d4.

📒 Files selected for processing (1)
  • README.md

📝 Walkthrough

Walkthrough

Updated the README’s example to import send using destructuring from @koa/send instead of assigning the required module directly.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the README CommonJS import fix.
Linked Issues check ✅ Passed The README example now uses the named send export as required by linked issue #152.
Out of Scope Changes check ✅ Passed The change is limited to the documented CommonJS import example and matches the stated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@sourcery-ai

sourcery-ai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the documentation to correctly show how to import the named send export from @koa/send in CommonJS usage, aligning the README example with the current library API without changing runtime behavior.

Flow diagram for updated CommonJS send import in README

flowchart TD
    A[CommonJS module] --> B[require @koa/send]
    B --> C[send destructured]
    C --> D[send used in Koa app example]
Loading

File-Level Changes

Change Details Files
Update CommonJS usage example in README to destructure the named send export from @koa/send.
  • Change the CommonJS import example from assigning the default export to using object destructuring for the named send export.
  • Ensure the example code snippet reflects the current re-export behavior from src/index.ts and no longer shows the stale const send = require("@koa/send") pattern.
README.md

Assessment against linked issues

Issue Objective Addressed Explanation
#152 Update the README.md documentation to use the correct CommonJS require syntax for @koa/send: const { send } = require('@koa/send') instead of const send = require('@koa/send').

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

[fix] Incorrect require statement in README.MD

1 participant