Skip to content

fix(cache): load storage drivers through file URLs - #971

Open
harlan-zw wants to merge 2 commits into
mainfrom
fix/issue-970
Open

harlan-zw wants to merge 2 commits into
mainfrom
fix/issue-970

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Closes #970

📚 Description

Issue #970 reports Windows startup failing with:

On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Use a file URL for the cache driver during Nitro startup, with a local path alias for server bundling. Native Windows startup still needs confirmation.

Nitro receives a file URL for native imports. A local path alias keeps the driver in the server bundle.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scripts-playground Error Error Nov 15, 2026 3:36am UTC

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts-devtools@971
npm i https://pkg.pr.new/@nuxt/scripts@971

commit: af1c2a3

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

📦 Package Size

⚠️ 3 size metrics grew

📚 22 runtime dependencies (no change)

Package output Gzipped Δ
@nuxt/scripts · dist/runtime 104 kB → 104 kB 🔴 +68 B (+0.1%)
@nuxt/scripts · published payload 223 kB → 223 kB 🔴 +68 B (+0.0%)
@nuxt/scripts · server runtime 30 kB → 30 kB 🔴 +68 B (+0.2%)
All tracked output (25)
Package output Gzipped Raw
@nuxt/scripts-cli · runtime dependencies 72 kB 355 kB ✅
@nuxt/scripts-cli · dependency magicast 72 kB 355 kB ✅
@nuxt/scripts-cli · export . 3.4 kB 12 kB ✅
@nuxt/scripts-cli · published payload 3.4 kB 12 kB ✅
@nuxt/scripts · runtime dependencies 543 kB 2.40 MB ✅
@nuxt/scripts · dependency @oxc-project/types 0 B 0 B ✅
@nuxt/scripts · dependency @vueuse/core 178 kB 720 kB ✅
@nuxt/scripts · dependency @vueuse/shared 39 kB 152 kB ✅
@nuxt/scripts · dependency lru-cache 141 kB 623 kB ✅
@nuxt/scripts · dependency semver 25 kB 72 kB ✅
@nuxt/scripts · dependency sirv 8.8 kB 21 kB ✅
@nuxt/scripts · dependency unstorage 70 kB 225 kB ✅
@nuxt/scripts · dependency valibot 82 kB 590 kB ✅
@nuxt/scripts · dist/runtime 104 kB 307 kB 🔴
@nuxt/scripts · export . 26 kB 107 kB ✅
@nuxt/scripts · export ./registry 30 kB 94 kB ✅
@nuxt/scripts · export ./stats 13 kB 92 kB ✅
@nuxt/scripts · export ./types-source 49 kB 247 kB ✅
@nuxt/scripts · published payload 223 kB 847 kB 🔴
@nuxt/scripts · app runtime 176 B 658 B ✅
@nuxt/scripts · components runtime 2.5 kB 6.4 kB ✅
@nuxt/scripts · composables runtime 7.8 kB 26 kB ✅
@nuxt/scripts · registry runtime 46 kB 136 kB ✅
@nuxt/scripts · server runtime 30 kB 89 kB 🔴
@nuxt/scripts · utils runtime 2.9 kB 8.1 kB ✅
Runtime dependencies (22)
Package Dependency Requested Resolved Cost
@nuxt/scripts-cli magicast ^0.5.5 0.5.5 📦 72 kB gzip
@nuxt/scripts-cli pathe ^2.0.3 2.0.3 ♻️ free via Nuxt 4.6.0
@nuxt/scripts @nuxt/kit ^4.6.0 4.6.0 ♻️ free via Nuxt 4.6.0
@nuxt/scripts @oxc-project/types ^0.153.0 0.153.0 📦 0 B gzip
@nuxt/scripts @vueuse/core ^15.0.0 15.0.0 📦 178 kB gzip
@nuxt/scripts @vueuse/shared ^15.0.0 15.0.0 📦 39 kB gzip
@nuxt/scripts consola ^3.4.2 3.4.2 ♻️ free via Nuxt 4.6.0
@nuxt/scripts defu ^6.1.7 6.1.7 ♻️ free via Nuxt 4.6.0
@nuxt/scripts lru-cache ^11.5.3 11.5.3 📦 141 kB gzip
@nuxt/scripts magic-string ^1.4.3 1.4.3 ♻️ free via Nuxt 4.6.0
@nuxt/scripts ofetch ^1.5.1 1.5.1 ♻️ free via Nuxt 4.6.0
@nuxt/scripts ohash ^2.0.12 2.0.12 ♻️ free via Nuxt 4.6.0
@nuxt/scripts oxc-walker ^1.1.1 1.1.1 ♻️ free via Nuxt 4.6.0
@nuxt/scripts pathe ^2.0.3 2.0.3 ♻️ free via Nuxt 4.6.0
@nuxt/scripts semver ^7.8.5 7.8.5 📦 25 kB gzip
@nuxt/scripts sirv ^3.0.2 3.0.2 📦 8.8 kB gzip
@nuxt/scripts std-env ^4.3.0 4.3.0 ♻️ free via Nuxt 4.6.0
@nuxt/scripts ufo ^1.6.4 1.6.4 ♻️ free via Nuxt 4.6.0
@nuxt/scripts ultrahtml ^1.7.0 1.7.0 ♻️ free via Nuxt 4.6.0
@nuxt/scripts unplugin ^3.4.0 3.4.0 ♻️ free via Nuxt 4.6.0
@nuxt/scripts unstorage ^1.17.5 1.17.5 📦 70 kB gzip
@nuxt/scripts valibot ^1.5.0 1.5.0 📦 82 kB gzip

Baseline: main_@_8ad678b0___2026-11-15 · gzip is the comparison metric · changes below 16 B gzip are ignored

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The cache storage configuration now uses a file URL for the driver path and adds an alias from that URL to the local driver path. It leaves an existing application cache mount unchanged. Tests cover native ESM loading from a path with spaces and URL-special characters, existing-mount preservation, and alias resolution.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: Minimal · up to af1c2

The change passes the cache driver as a file URL and aliases it to the local path, which addresses the Windows loader error in #970. No concrete defect was found in the reviewed diff. Native Windows startup still needs the author's confirmation.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: cache storage drivers are now loaded through file URLs. It matches the summarised change in cache-config.ts, where the driver path is converted to a file URL. It follo…
Description check Passed The description links issue #970, explains the Windows startup error with drive-letter paths such as c:, and states the approach: a file URL for the cache driver plus a local path alias for server bun…
Linked Issues check Passed Issue #970 requires Nuxt startup to succeed on Windows. The default ESM loader rejects a drive-letter path such as c: as a URL scheme. At the reviewed head, ensureNuxtScriptsCacheStorage in `packa…
Out of Scope Changes check Passed The reviewed production change in cache-config.ts is limited to the cache driver path. It adds the pathToFileURL import, an optional alias field on the local options type, and the file-URL mount…
Full details: Title check

Explanation

The title names the main change: cache storage drivers are now loaded through file URLs. It matches the summarised change in cache-config.ts, where the driver path is converted to a file URL. It follows the conventional commit form and is specific enough for a reviewer scanning history.

Full details: Description check

Explanation

The description links issue #970, explains the Windows startup error with drive-letter paths such as c:, and states the approach: a file URL for the cache driver plus a local path alias for server bundling. This matches the raw summary. It also notes that native Windows startup is still unconfirmed.

Full details: Linked Issues check

Explanation

Issue #970 requires Nuxt startup to succeed on Windows. The default ESM loader rejects a drive-letter path such as c: as a URL scheme. At the reviewed head, ensureNuxtScriptsCacheStorage in packages/script/src/runtime/server/utils/cache-config.ts converts the cache driver path with pathToFileURL(driver).href and stores that file: URL as the mount driver. It also adds nitroOptions.alias[driverURL] = driver, so Rollup can bundle the driver from a local path. The file read confirms this behaviour. The mount is created only when no kv or storage mount exists, so application-configured mounts are preserved. The summary reports tests for native ESM loading from a path with special characters on Nitro v2 and v3, mount preservation, and alias resolution in test/unit/cached-upstream-lifecycle.test.ts. I did not read the test file directly. The diff tool was unavailable for this review, so the changes since the previous reviewed head were not confirmed by diff. The file content at head matches the previous assessment. The PR description states that native Windows startup still needs confirmation. This is manual verification and not a coding requirement, so it does not change the verdict.

Full details: Out of Scope Changes check

Explanation

The reviewed production change in cache-config.ts is limited to the cache driver path. It adds the pathToFileURL import, an optional alias field on the local options type, and the file-URL mount and alias logic. Each of these supports the #970 objective. The summary reports test changes in test/unit/cached-upstream-lifecycle.test.ts that check the same behaviour. No unrelated production change appears in the summary or in the reviewed file. The diff tool was unavailable, so I could not confirm the full changed-file list against the merge base. This leaves a small uncertainty about files outside the summary, but the summary lists only the two in-scope files.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b466bf09-26be-4c80-a3dc-257d3e5cf3b1
Commits

Reviewing files that changed from the base of the PR and between 3b8318d and af1c2a3.

Files selected for processing: 2

  • packages/script/src/runtime/server/utils/cache-config.ts
  • test/unit/cached-upstream-lifecycle.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@harlan-zw harlan-zw added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Oct 27, 2026
@harlan-zw

harlan-zw commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

🤖 READY · 85/100

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. A person still decides the merge.

  • Merge gate: Passed.
  • Review gate: Passed. No material issues.
  • CI gate: Passed.

@harlan-zw harlan-zw added harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Oct 27, 2026
@harlan-zw harlan-zw added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-blocked The automated Review found a material defect in this head commit. and removed harlan-agent-ready The automated Review passed every gate on this head commit. harlan-agent-running An Agent holds a Task on this issue or pull request right now. labels Nov 15, 2026
@harlan-zw harlan-zw added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-pending The automated Review is waiting on a gate for this head commit. harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-blocked The automated Review found a material defect in this head commit. harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-pending The automated Review is waiting on a gate for this head commit. labels Nov 15, 2026

This branch had an error being deployed

1 failed deployment
Preview — af1c2a3e Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

harlan-agent-ready The automated Review passed every gate on this head commit.

Projects

None yet

1 participant