Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

feat(kit): support followSymbolicLinks option for resolveFiles - #6240

Merged
pi0 merged 4 commits into
nuxt:mainfrom
Diizzayy:patch
Aug 2, 2022
Merged

feat(kit): support followSymbolicLinks option for resolveFiles#6240
pi0 merged 4 commits into
nuxt:mainfrom
Diizzayy:patch

Conversation

@Diizzayy

Copy link
Copy Markdown
Member
  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR allows module authors to opt-out of following symbolic links when using resolveFiles, as there are many cases where this current default isn't the desired.

@netlify

netlifyBot commented Jul 29, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit2a6f905
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62e7932876410a000853184c

@pi0pi0 changed the title fix(kit): improve resolveFiles by allowing opt-out of followSymbolicLinksfeat(kit): support followSymbolicLinks option for resolveFilesJul 29, 2022
Comment threadpackages/kit/src/resolve.ts Outdated

export async function resolveFiles (path: string, pattern: string | string[]) {
const files = await globby(pattern, { cwd: path, followSymbolicLinks: true })
export async function resolveFiles (path: string, pattern: string | string[], followSymbolicLinks: boolean = true) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please make 3rd argument an object { followSymbolicLinks }

@pi0

pi0 commented Jul 29, 2022

Copy link
Copy Markdown
Member

Thanks for PR @Diizzayy. In the future, please consider opening an issue describing improvement and enhancement 🙏🏼 Also what is the current use case you have for this utility for skipping link resolution? Knowing context, can help to improve utilities and be aware of usecases.

@Diizzayy

Copy link
Copy Markdown
MemberAuthor

In the future, please consider opening an issue describing improvement and enhancement 🙏🏼

Sorry about that, I had begun writing an issue when I realized that this was the underlying cause.
I'll be sure to keep this in mind going forward. I jumped the gun here.

Also what is the current use case you have for this utility for skipping link resolution

@pi0 When using pnpm workspaces which uses symlinks between packages, you'll find that based on how the resolveFiles utility is used in a module, it's default behavior ( following symlinks ) can result in scanning deeply nested files in node_modules that match the pattern ( which may not be the desired ). This can also lead to an almost infinite loop of resolving files when a symlinked package depends on another that also contains matching files (which is where I encountered it).

Comment threadpackages/kit/src/resolve.ts Outdated
Comment threadpackages/kit/src/resolve.ts Outdated
pi0
pi0 approved these changes Aug 1, 2022
@pi0
pi0 merged commit 8efaad4 into nuxt:mainAug 2, 2022
@Diizzayy
Diizzayy deleted the patch branch August 2, 2022 12:29
@pi0pi0 mentioned this pull request Aug 5, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Diizzayy@pi0@danielroe