Skip to content
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

feat(node/fs): add fs.glob, fs.globSync, and fs.promises.glob #16676

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DonIsaac
Copy link
Contributor

@DonIsaac DonIsaac commented Jan 23, 2025

What does this PR do?

Closes #13623
Closes #14631

Adds basic support for fs.glob, fs.globSync, and fs.promises.glob.

These partial implementations should unblock basic use cases. Upstack PRs will move logic into native code (causing Bun.Glob to benefit) and add for support more options.

Missing APIs

  • Only a single pattern may be provided.
  • options.withFileTypes
  • `options

How did you verify your code works?

  • I included a test for the new code, or existing tests cover it
  • I ran my tests locally and they pass (bun-debug test test-file-name.test)
  • Types already exist in @types/node's node:fs

@robobun
Copy link

robobun commented Jan 23, 2025

Updated 9:26 PM PT - Jan 23rd, 2025

@DonIsaac, your commit 4717af9 has 2 failures in #10431:


🧪   try this PR locally:

bunx bun-pr 16676

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@DonIsaac DonIsaac added node:fs enhancement New feature or request labels Jan 23, 2025 — with Graphite App
@DonIsaac DonIsaac force-pushed the don/feat/fs-glob branch 3 times, most recently from 1925f67 to 74bc41e Compare January 24, 2025 00:40
@DonIsaac DonIsaac requested a review from zackradisic January 24, 2025 00:40
@DonIsaac DonIsaac marked this pull request as ready for review January 24, 2025 03:18
Copy link
Member

@nektro nektro left a comment

Choose a reason for hiding this comment

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

mostly good but small comments. does this add any passing node tests?

src/js/internal/fs/glob.ts Outdated Show resolved Hide resolved
src/js/internal/fs/glob.ts Outdated Show resolved Hide resolved
src/js/node/fs.ts Outdated Show resolved Hide resolved
src/js/node/fs.ts Outdated Show resolved Hide resolved
src/js/node/fs.ts Outdated Show resolved Hide resolved
src/js/internal/fs/glob.ts Outdated Show resolved Hide resolved
src/js/node/fs.promises.ts Show resolved Hide resolved
@DonIsaac
Copy link
Contributor Author

mostly good but small comments. does this add any passing node tests?

this implementation is too minimal for test-fs-glob.mjs to pass, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request node:fs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node.js Compat: glob in node:fs/promises Implement globSync in node:fs
3 participants