Skip to content

feat: basic createRequire support.#47

Merged
knightedcodemonkey merged 2 commits into
mainfrom
bananas
May 25, 2026
Merged

feat: basic createRequire support.#47
knightedcodemonkey merged 2 commits into
mainfrom
bananas

Conversation

@knightedcodemonkey
Copy link
Copy Markdown
Owner

Copilot AI review requested due to automatic review settings May 25, 2026 00:27
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 98.05556% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.91%. Comparing base (08e8f43) to head (9ee5c0e).

Files with missing lines Patch % Lines
src/format.ts 98.05% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main      #47      +/-   ##
===========================================
- Coverage   100.00%   98.91%   -1.09%     
===========================================
  Files            3        3              
  Lines          321      645     +324     
  Branches        40      120      +80     
===========================================
+ Hits           321      638     +317     
- Misses           0        5       +5     
- Partials         0        2       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

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

Adds support for rewriting specifiers in calls made through require functions created via Node’s createRequire() factory, addressing #23.

Changes:

  • Extend src/format.ts to track createRequire factories and the require-like aliases they create, so alias calls (and .resolve) are eligible for rewriting.
  • Add a comprehensive test suite covering aliasing, renaming, reassignment, and shadowing scenarios for createRequire.
  • Update README feature list and bump package version to 3.1.0.

Reviewed changes

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

Show a summary per file
File Description
test/updateSrc.ts Adds tests for createRequire() alias rewriting, shadowing, and reassignment behaviors.
src/format.ts Implements binding/scope tracking to identify createRequire factories and derived require aliases.
README.md Documents support for createRequire() aliases in the parsed constructs list.
package.json Bumps version to 3.1.0 for the new feature.
package-lock.json Updates lockfile version metadata to match 3.1.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/format.ts Outdated
Comment thread src/format.ts Outdated
Comment thread src/format.ts
@knightedcodemonkey knightedcodemonkey merged commit 90fc387 into main May 25, 2026
8 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch May 25, 2026 00:42
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.

Support createRequire()

2 participants