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

tinyglobby inconsistent to fast-glob with absolute patterns that have \ #72

Open
userquin opened this issue Nov 12, 2024 · 10 comments
Open

Comments

@userquin
Copy link

Check vuejs/vitepress#4357

@SuperchupuDev
Copy link
Owner

SuperchupuDev commented Nov 12, 2024

i'm on windows and absolute patterns should work, can you provide a minimal repro? whatever it is if it's perf related #69 will probably solve it

@userquin
Copy link
Author

userquin commented Nov 12, 2024

clone VP (VitePress) repo then pnpm install && pnpm build

@SuperchupuDev
Copy link
Owner

SuperchupuDev commented Nov 12, 2024

it's using an absolute path with \s, which normally shouldn't be used in glob patterns in neither fast-glob or tinyglobby (https://github.com/mrmlnc/fast-glob#pattern-syntax). will investigate how fast-glob handles them when the pattern is absolute though

image

@userquin
Copy link
Author

userquin commented Nov 12, 2024

FYI: I added fast-glob in VP repo pnpm add -D fast-glob -w changing the rollup.config.ts import and usage and it works:

// foo.js => node ./foo.js
import { resolve, normalize } from 'node:path'
import { fileURLToPath } from 'node:url'
import { globSync } from 'tinyglobby'

const ROOT = fileURLToPath(import.meta.url)
const r = (p) => normalize(resolve(ROOT, '..', p))

console.log(r('src/node/worker_*.ts'))
console.log(
  globSync('src/node/worker_*.ts', {
    cwd: r('.'),
    onlyFiles: true,
    expandDirectories: false
  })
)
console.log('RUNNING')

@SuperchupuDev SuperchupuDev changed the title tinyglobby hangs when using absolute paths in patterns on Windows tinyglobby inconsistent to fast-glob with absolute patterns that have \ Nov 12, 2024
@userquin
Copy link
Author

https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#how-to-write-patterns-on-windows

fast-glob handles that, but doesn't recommend

Using simple replacement works:

imagen

@SuperchupuDev
Copy link
Owner

will try to make it as consistent to fast-glob as possible

@Torathion
Copy link

Any news on this? This is probably the biggest reason that prevents many tools from switch from fast-glob to tinyglobby.

@SuperchupuDev
Copy link
Owner

is it? thought it wasn't a priority since the issue author's linked repo no longer has the problem. can take a deeper look into it for the next release that i want to release ASAP

@Torathion
Copy link

From what I've gathered: The windows glob issues are very important. OP came from vitepress having this issue and remix and analog also referring to this issue. I wanted to make a PR in npm-check-updates and came across the same issue as a dozen tests started to fail after switching from fast-glob to tinyglobby.

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

No branches or pull requests

3 participants