-
Notifications
You must be signed in to change notification settings - Fork 24
fix: don't globSync redundantly #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #511 +/- ##
==========================================
- Coverage 80.81% 80.79% -0.02%
==========================================
Files 121 119 -2
Lines 11984 11864 -120
Branches 846 843 -3
==========================================
- Hits 9685 9586 -99
+ Misses 2296 2275 -21
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical Windows compatibility issue where globSync was being called on complete file paths rather than glob patterns, which breaks on Windows since Windows paths (e.g., C:\path\to\file) are not valid glob patterns.
The fix removes the redundant loader layer (src/loaders/markdown.mjs and src/loaders/javascript.mjs) that was performing unnecessary globSync operations in the file processing pipeline, and replaces them with direct usage of the to-vfile library's read function.
Key changes:
- Eliminates redundant
globSynccalls on complete file paths that broke Windows - Simplifies the architecture by removing the loader abstraction layer
- Refactors the JavaScript parser from a factory pattern to a direct export
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/parsers/javascript.mjs | Refactored from factory pattern to direct function export; removes wrapper without changing core parsing logic |
| src/loaders/markdown.mjs | Deleted loader that was calling globSync on complete file paths |
| src/loaders/javascript.mjs | Deleted loader that was calling globSync on complete file paths |
| src/generators/ast/index.mjs | Updated to use to-vfile's read function directly instead of going through the markdown loader |
| src/generators/ast-js/index.mjs | Updated to use to-vfile's read function directly and import parseJsSource as a named export |
| package.json | Added to-vfile@^8.0.0 dependency for direct file reading |
| npm-shrinkwrap.json | Lockfile updates for the new to-vfile dependency and automatic peer dependency resolution changes |
Files not reviewed (1)
- npm-shrinkwrap.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
#509 broke Windows runs of
doc-kit, asglobSyncwas called on complete file paths.This doesn't break Unix, since a complete unix path is a valid glob. A complete Windows path, however, is not a valid glob.
So, this PR removes the
loaders/, as they are performed in theastandast-jsgenerators directly.Requesting fast-track, as this breaks windows.