Skip to content

Commit

Permalink
feat: replace fast-glob with tinyglobby (#6167)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Dent <Jason3S@users.noreply.github.com>
Co-authored-by: Jason Dent <Jason3S@users.noreply.github.com>
  • Loading branch information
benmccann and Jason3S authored Oct 1, 2024
1 parent fcbd56d commit 8f00d78
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 30 deletions.
4 changes: 2 additions & 2 deletions packages/cspell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@
"cspell-glob": "workspace:*",
"cspell-io": "workspace:*",
"cspell-lib": "workspace:*",
"fast-glob": "^3.3.2",
"fast-json-stable-stringify": "^2.1.0",
"file-entry-cache": "^9.1.0",
"get-stdin": "^9.0.0",
"semver": "^7.6.3",
"strip-ansi": "^7.1.0"
"strip-ansi": "^7.1.0",
"tinyglobby": "^0.2.8"
},
"engines": {
"node": ">=18"
Expand Down
9 changes: 6 additions & 3 deletions packages/cspell/src/app/util/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import { posix } from 'node:path';
import type { CSpellUserSettings, Glob } from '@cspell/cspell-types';
import type { GlobPatternWithRoot } from 'cspell-glob';
import { fileOrGlobToGlob, GlobMatcher } from 'cspell-glob';
import type { Options as FastGlobOptions } from 'fast-glob';
import glob from 'fast-glob';
import type { GlobOptions as TinyGlobbyOptions } from 'tinyglobby';
import { glob } from 'tinyglobby';

import { clean } from './util.js';

// cspell:ignore tinyglobby

/**
* This is a subset of IOptions from 'glob'.
*/
Expand All @@ -34,13 +36,14 @@ export async function globP(pattern: string | string[], options?: GlobOptions):
const onlyFiles = options?.nodir;
const dot = options?.dot;
const patterns = typeof pattern === 'string' ? [pattern] : pattern;
const useOptions: FastGlobOptions = clean({
const useOptions: TinyGlobbyOptions = clean({
cwd,
onlyFiles,
dot,
ignore,
absolute: true,
followSymbolicLinks: false,
expandDirectories: false,
});

const compare = new Intl.Collator('en').compare;
Expand Down
71 changes: 46 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8f00d78

Please sign in to comment.