Skip to content

fix: resolve directory and extensionless client paths - #54

Merged
codepunkt merged 1 commit into
mainfrom
fix/resolve-client-entry
Nov 14, 2026
Merged

codepunkt merged 1 commit into
mainfrom
fix/resolve-client-entry

Conversation

@codepunkt

Copy link
Copy Markdown
Owner

Follow-up to #53. Addresses both CodeRabbit comments on it.

  • Directory and extensionless paths (regression). require() resolved a clientPath like /abs/node_modules/.prisma/client or ./generated/client to its entry file. import() refuses directories (ERR_UNSUPPORTED_DIR_IMPORT). File paths now go through require.resolve() first. If that fails, for example for a .ts file require() can't handle, the path goes to import() unchanged.
  • README. Loading a generated client.ts natively also needs "type": "module" in the nearest package.json. Otherwise Node loads it as CommonJS and its import statements fail.

Verification

  • Lint, format, typecheck, tests (100% coverage) and build pass. New tests cover a directory path and an extensionless path.
  • Ran the built dist in plain Node: an absolute path to a CommonJS client directory (package.json + index.js, shaped like .prisma/client) loads, and a .ts client still loads.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 86024fa and 4c686ea.

Files selected for processing: 4

  • README.md
  • src/contest.test.ts
  • src/context.ts
  • test/client-dir/index.js

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "review"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (86024fa) to head (4c686ea).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #54   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           83        89    +6     
  Branches        15        15           
=========================================
+ Hits            83        89    +6     

☔ View full report in Codecov by Harness.
📢 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.

@codepunkt
codepunkt merged commit 5d65e37 into main Nov 14, 2026
4 checks passed
@codepunkt
codepunkt deleted the fix/resolve-client-entry branch November 14, 2026 08:02
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.

2 participants