Skip to content

fix(fs): ignore globs fail under dot-prefixed directories#768

Open
janvennemann wants to merge 2 commits into
unjs:v1from
janvennemann:fix/fs-ignore-dot-paths
Open

fix(fs): ignore globs fail under dot-prefixed directories#768
janvennemann wants to merge 2 commits into
unjs:v1from
janvennemann:fix/fs-ignore-dot-paths

Conversation

@janvennemann
Copy link
Copy Markdown

@janvennemann janvennemann commented Mar 31, 2026

Summary

Backport fix for v1. The v2 alpha already resolved this by switching to node:path's matchesGlob on relative paths.

  • The fs driver's ignore matcher (defaulting to **/node_modules/** and **/.git/**) uses anymatch, which delegates to picomatch
  • picomatch does not match ** across dot-prefixed path segments by default (e.g. .codex, .claude)
  • When the storage base is under a hidden directory, the ignore globs silently fail and chokidar watches thousands of node_modules files

This is particularly problematic when using git worktrees created by Claude Code or Codex, which place worktrees under ~/.claude/ or ~/.codex/ respectively. Any Nuxt project with DevTools enabled ends up watching all of node_modules because the **/node_modules/** ignore pattern can't match through the dot-prefixed ancestor.

The fix passes { dot: true } to anymatch so ** crosses dot-prefixed segments.

Fixes #750
Related: nuxt/nuxt#33300

Summary by CodeRabbit

  • New Features

    • Added generation of additional TypeScript type declaration formats.
  • Bug Fixes

    • Updated core dependencies including file system watcher library to latest major version.
  • Documentation

    • Added changelog entries for versions v1.17.4, v1.17.3, and v1.17.2.
  • Chores

    • Removed automated publishing workflow.
    • Adjusted TypeScript export configuration.
    • Updated multiple development dependencies.

@janvennemann janvennemann requested a review from pi0 as a code owner March 31, 2026 16:46
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: adec1fe8-694a-4682-9c86-9e5fa9bea9cf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes update package version to 1.17.4, remove automated publishing workflow, refactor the FS driver's ignore pattern matching to support dot-prefixed directories, adjust type exports, and add post-build generation of CommonJS and ES module type declaration files.

Changes

Cohort / File(s) Summary
Publishing Workflow Removal
.github/workflows/publish.yml
Removed automated GitHub Actions workflow that published nightly canary releases on pushes to main branch.
Build Configuration & Ignores
build.config.ts, .gitignore
Added post-build hook to generate .d.cts and .d.mts type declaration files alongside .d.ts outputs; added TypeScript incremental build cache file to ignore patterns.
Package Metadata & Dependencies
package.json
Version bumped to 1.17.4; removed types export conditions for ./drivers/*, ., and ./server; updated chokidar to v5, lru-cache to v11, and numerous dev dependencies; adjusted peer dependency ranges for @capacitor/preferences and @vercel/kv; refreshed pnpm ignored build dependencies list.
Driver Refactoring
src/drivers/fs.ts
Converted chokidar imports to type-only; refactored ignore pattern matching to use anymatch(ignorePatterns, path, { dot: true }) instead of direct matcher construction, enabling matching of dot-prefixed directory segments; added dynamic chokidar import within watch function.
Driver Formatting Updates
src/drivers/netlify-blobs.ts, src/drivers/s3.ts
Collapsed multi-line interface extends clauses into single-line format for Netlify driver; removed ESLint disable directive from S3 driver's sha256Base64 implementation.
Release Documentation
CHANGELOG.md
Added release notes for v1.17.4 (fs refactor, chokidar v5 upgrade), v1.17.3 (type declaration generation), and v1.17.2 (CJS masquerading fix, docs/deps updates) with contributor information.
Test Configuration
test/drivers/azure-key-vault.test.ts, test/drivers/localstorage.test.ts, test/drivers/session-storage.test.ts
Refactored Azure Key Vault describe.skip syntax for clarity; disabled JSDOM virtual console forwarding to global console in localStorage and sessionStorage tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • #751: Modifies the same FS driver ignore matching logic using picomatch.isMatch(..., { dot: true }) to fix dot-prefixed directory traversal issues.

Suggested reviewers

  • pi0

Poem

🐰 Hops through dot-paths with a cheer,
Type declarations multiply here,
The FS driver's now fixed bright,
Publishing fades into the night,
Version bumps and deps take flight!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes multiple out-of-scope changes unrelated to fixing the dot-prefixed directory issue: removed publish workflow, updated build.config.ts for .d.cts/.d.mts generation, removed types from package.json exports, and numerous dependency updates. Separate the dot-prefixed directory fix into its own focused PR containing only src/drivers/fs.ts changes, and move infrastructure/dependency updates to a dedicated PR.
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 (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(fs): ignore globs fail under dot-prefixed directories' accurately describes the primary fix in the changeset.
Linked Issues check ✅ Passed The PR implements the required v1.x fix by passing { dot: true } to anymatch in fs.ts, directly addressing the core requirement from issue #750.

✏️ 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.

@janvennemann janvennemann changed the base branch from main to v1 March 31, 2026 16:47
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
package.json (1)

191-199: ⚠️ Potential issue | 🟠 Major

Remove esbuild from one of the two pnpm build-policy lists.

esbuild currently appears in both ignoredBuiltDependencies and onlyBuiltDependencies. This conflicting configuration will cause inconsistent install-script behavior. Decide whether esbuild should be ignored or only-built, then remove it from the other list.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 191 - 199, The package.json currently lists
"esbuild" in both the ignoredBuiltDependencies and onlyBuiltDependencies arrays;
remove the duplicate by deciding the intended policy and deleting "esbuild" from
the other array so it appears in only one place. Open package.json, find the
ignoredBuiltDependencies and onlyBuiltDependencies arrays, and remove the
"esbuild" entry from whichever list is not the desired policy (leave it only in
the intended list) to eliminate the conflicting configuration.
🧹 Nitpick comments (2)
test/drivers/localstorage.test.ts (1)

10-10: Optional cleanup: remove commented-out console forwarding line.

This is fine functionally, but removing dead commented code will keep the test file easier to scan.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/drivers/localstorage.test.ts` at line 10, Remove the dead commented-out
line "jsdom.virtualConsole.sendTo(console);" from the test file—locate the
commented forwarding call (the commented jsdom.virtualConsole.sendTo(console)
line) and delete it to clean up the test and improve readability.
test/drivers/session-storage.test.ts (1)

10-10: Prefer removing commented-out test setup instead of leaving it inline.

If console forwarding is intentionally disabled, consider deleting this line rather than commenting it, to keep test setup clean.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/drivers/session-storage.test.ts` at line 10, Remove the commented-out
console forwarding line (the jsdom.virtualConsole.sendTo(console) comment) from
the test setup in session-storage.test.ts; if forwarding is intentionally
disabled, delete the commented line instead of leaving it inline to keep the
test file clean and avoid dead/commented code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@package.json`:
- Around line 191-199: The package.json currently lists "esbuild" in both the
ignoredBuiltDependencies and onlyBuiltDependencies arrays; remove the duplicate
by deciding the intended policy and deleting "esbuild" from the other array so
it appears in only one place. Open package.json, find the
ignoredBuiltDependencies and onlyBuiltDependencies arrays, and remove the
"esbuild" entry from whichever list is not the desired policy (leave it only in
the intended list) to eliminate the conflicting configuration.

---

Nitpick comments:
In `@test/drivers/localstorage.test.ts`:
- Line 10: Remove the dead commented-out line
"jsdom.virtualConsole.sendTo(console);" from the test file—locate the commented
forwarding call (the commented jsdom.virtualConsole.sendTo(console) line) and
delete it to clean up the test and improve readability.

In `@test/drivers/session-storage.test.ts`:
- Line 10: Remove the commented-out console forwarding line (the
jsdom.virtualConsole.sendTo(console) comment) from the test setup in
session-storage.test.ts; if forwarding is intentionally disabled, delete the
commented line instead of leaving it inline to keep the test file clean and
avoid dead/commented code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 051df150-abdd-4307-9c4f-e8d36bf97b20

📥 Commits

Reviewing files that changed from the base of the PR and between fb7b8aa and 144ff35.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • .github/workflows/publish.yml
  • .gitignore
  • CHANGELOG.md
  • build.config.ts
  • package.json
  • src/drivers/fs.ts
  • src/drivers/netlify-blobs.ts
  • src/drivers/s3.ts
  • test/drivers/azure-key-vault.test.ts
  • test/drivers/localstorage.test.ts
  • test/drivers/session-storage.test.ts
💤 Files with no reviewable changes (1)
  • .github/workflows/publish.yml

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.

FS driver: ignore patterns fail in dot-prefixed directories (EMFILE)

1 participant