Skip to content

fix(deps): replace glob usage with fast-glob #6384

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

mrstork
Copy link
Contributor

@mrstork mrstork commented May 23, 2025

Summary

This work started off with remaking #6143 (i.e. upgrading glob to the highest version we can support) but turned into simply trying to remove the package from our dependencies instead with the aim of reducing our package size.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@mrstork mrstork force-pushed the fix/upgrade-glob branch 3 times, most recently from 8983e60 to be136d8 Compare May 28, 2025 19:14
@mrstork mrstork force-pushed the fix/upgrade-glob branch from be136d8 to 3242f9b Compare May 30, 2025 20:35
@mrstork mrstork force-pushed the fix/upgrade-glob branch from 3242f9b to d5e6f2a Compare May 31, 2025 01:57
@mrstork mrstork changed the title fix(deps): upgrade glob to v10 fix(deps): replace glob usage with fast-glob May 31, 2025
cwd: baseDir,
})

result.push(...resolved)
// esbuild expects relative paths, but tinyglobby uses `posix.normalize()` which strips leading `./`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Credit to @serhalp for figuring this one out

Copy link
Member

Choose a reason for hiding this comment

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

This comment is about tinyglobby (from my other PR), but here we're switching to fast-glob.

AFAICT from reading the fast-glob source and tests, this shouldn't be needed, I think. I wonder if this is resulting in ././foo which happens to still work fine?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah let's figure out if that's the case and avoid the duplicated segments if possible.

Copy link
Contributor Author

@mrstork mrstork Jun 4, 2025

Choose a reason for hiding this comment

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

Without this code the test included_files with multiple glob stars are correctly resolved before passing to esbuild fails because lang/en.json is missing the leading ./. I'll update the comment though.

@mrstork mrstork marked this pull request as ready for review May 31, 2025 02:29
@mrstork mrstork requested a review from a team as a code owner May 31, 2025 02:29
"filter-obj": "^6.0.0",
"find-up": "^7.0.0",
"glob": "^8.0.3",
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@serhalp serhalp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for taking this over! Just one callout

@@ -17,8 +17,7 @@ export const getSideFiles = async function (functionPath: string, stat: Stats):
const paths = await glob(`${functionPath}/**`, {
absolute: true,
cwd: functionPath,
ignore: `**/node_modules/**`,
nodir: true,
Copy link
Member

Choose a reason for hiding this comment

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

👍🏼 fast-glob onlyFiles is true by default, I see: https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#onlyfiles

cwd: baseDir,
})

result.push(...resolved)
// esbuild expects relative paths, but tinyglobby uses `posix.normalize()` which strips leading `./`
Copy link
Member

Choose a reason for hiding this comment

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

This comment is about tinyglobby (from my other PR), but here we're switching to fast-glob.

AFAICT from reading the fast-glob source and tests, this shouldn't be needed, I think. I wonder if this is resulting in ././foo which happens to still work fine?

eduardoboucas
eduardoboucas previously approved these changes Jun 4, 2025
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.

3 participants