Skip to content

fix(integration): use fileURLToPath to correctly resolve the build dir path on Windows#36

Open
DDeenis wants to merge 1 commit into
rishi-raj-jain:masterfrom
DDeenis:fix/integration-windows
Open

fix(integration): use fileURLToPath to correctly resolve the build dir path on Windows#36
DDeenis wants to merge 1 commit into
rishi-raj-jain:masterfrom
DDeenis:fix/integration-windows

Conversation

@DDeenis

@DDeenis DDeenis commented Jun 2, 2026

Copy link
Copy Markdown

Resolves #35

From Node.js docs:

new URL('file:///C:/path/').pathname;      // Incorrect: /C:/path/
fileURLToPath('file:///C:/path/');         // Correct:   C:\path\ (Windows)

Summary by CodeRabbit

  • Bug Fixes
    • Improved build directory path resolution to ensure correct handling of file paths during the build process.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f8492498-d0c8-4616-bdea-4f6de2a660cf

📥 Commits

Reviewing files that changed from the base of the PR and between 32d0cd3 and e481ba6.

📒 Files selected for processing (1)
  • packages/astro-font/integration.ts

📝 Walkthrough

Walkthrough

The PR corrects Windows path resolution in the Astro integration hook by replacing direct pathname access with Node's fileURLToPath API, ensuring properly formatted file paths across platforms.

Changes

Windows Path Resolution Fix

Layer / File(s) Summary
Build directory path resolution via fileURLToPath
packages/astro-font/integration.ts
buildDir is now computed using fileURLToPath(dir) instead of dir.pathname, with a dynamic import of fileURLToPath from node:url, fixing incorrect path syntax errors on Windows during the astro:build:done hook.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Windows paths were twisted and wrong,
A rabbit hopped in with a fix—
fileURLToPath strong,
No more pathname mix! 🛠️✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: using fileURLToPath to fix Windows path resolution in the build directory derivation.
Linked Issues check ✅ Passed The code changes directly address issue #35 by implementing fileURLToPath for correct Windows path resolution, preventing the ENOPROTOOPT error from incorrect path formats.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the Windows path resolution bug in the astro:build:done hook, with no unrelated modifications present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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.

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.

Astro integration crashes on Windows

1 participant