Skip to content

Commit 347d70f

Browse files
committed
chore(deps): switch to tinyglobby
1 parent 724c7f8 commit 347d70f

File tree

7 files changed

+50
-44
lines changed

7 files changed

+50
-44
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
"eslint-plugin-import": "^2.26.0",
109109
"eslint-plugin-prettier": "^4.2.1",
110110
"expect": "^27.5.1",
111-
"fast-glob": "^3.3.3",
112111
"fetch-mock": "^9.11.0",
113112
"file-entry-cache": "^6.0.1",
114113
"husky": "^7.0.4",
@@ -126,6 +125,7 @@
126125
"patch-package": "^6.4.7",
127126
"prettier": "^2.4.1",
128127
"semantic-release": "^19.0.5",
128+
"tinyglobby": "^0.2.14",
129129
"ts-jest": "^29.2.5",
130130
"ts-node": "^10.8.2",
131131
"typescript": "4.4.4"

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
"@stoplight/spectral-runtime": "^1.1.2",
4747
"@stoplight/types": "^13.6.0",
4848
"chalk": "4.1.2",
49-
"fast-glob": "~3.2.12",
5049
"hpagent": "~1.2.0",
5150
"lodash": "~4.17.21",
5251
"pony-cause": "^1.1.1",
5352
"stacktracey": "^2.1.8",
53+
"tinyglobby": "^0.2.14",
5454
"tslib": "^2.8.1",
5555
"yargs": "~17.7.2"
5656
},

packages/cli/src/services/linter/utils/__tests__/listFiles.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as path from '@stoplight/path';
2-
import * as fg from 'fast-glob';
2+
import { glob } from 'tinyglobby';
33
import { listFiles } from '../listFiles';
44

5-
jest.mock('fast-glob', () => jest.fn(async () => []));
5+
jest.mock('glob', () => jest.fn(async () => []));
66

77
describe('listFiles CLI util', () => {
88
it('unixify paths', () => {
99
listFiles(['.\\repro\\lib.yaml', './foo/*.json', '.\\src\\__tests__\\__fixtures__\\*.oas.json'], true);
10-
expect(fg).toBeCalledWith(['./repro/lib.yaml', './foo/*.json', './src/__tests__/__fixtures__/*.oas.json'], {
10+
expect(glob).toBeCalledWith(['./repro/lib.yaml', './foo/*.json', './src/__tests__/__fixtures__/*.oas.json'], {
1111
dot: true,
1212
absolute: true,
1313
});
@@ -16,15 +16,15 @@ describe('listFiles CLI util', () => {
1616
it('returns file paths', async () => {
1717
const list = [path.join(__dirname, 'foo/a.json'), path.join(__dirname, 'foo/b.json')];
1818

19-
(fg as unknown as jest.Mock).mockResolvedValueOnce([...list]);
19+
(glob as unknown as jest.Mock).mockResolvedValueOnce([...list]);
2020

2121
expect(await listFiles(['./foo/*.json'], true)).toEqual([list, []]);
2222
});
2323

2424
it('given disabled ignoredUnmatchedGlobs, reports unmatched patterns', async () => {
2525
const list = [path.join(__dirname, 'foo/a.json'), path.join(__dirname, 'foo/b.json')];
2626

27-
(fg as unknown as jest.Mock).mockImplementation(async pattern => {
27+
(glob as unknown as jest.Mock).mockImplementation(async pattern => {
2828
if (pattern === './foo/*.json') {
2929
return list;
3030
}

packages/cli/src/services/linter/utils/listFiles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { normalize } from '@stoplight/path';
2-
import fg from 'fast-glob';
2+
import { glob } from 'tinyglobby';
33

44
const GLOB_OPTIONS = {
55
absolute: true,
66
dot: true,
77
};
88

9-
async function match(pattern: fg.Pattern | fg.Pattern[]): Promise<string[]> {
10-
return (await fg(pattern, GLOB_OPTIONS)).map(normalize);
9+
async function match(pattern: string | string[]): Promise<string[]> {
10+
return (await glob(pattern, GLOB_OPTIONS)).map(normalize);
1111
}
1212

1313
const compareString = (a: string, b: string): number => a.localeCompare(b);

packages/formatters/scripts/bundle-html-templates.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import * as astring from 'astring';
66
import { builders as b } from 'ast-types';
77

88
import eol from 'eol';
9-
import fg from 'fast-glob';
9+
import { glob } from 'tinyglobby';
1010

1111
const cwd = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
1212

13-
fg('src/html/*.html', { cwd, absolute: true })
13+
glob('src/html/*.html', { cwd, absolute: true, expandDirectories: false })
1414
.then(files =>
1515
Promise.all(
1616
files.map(async file => ({ file: path.basename(file), content: eol.lf(await fs.readFile(file, 'utf8')) })),

test-harness/scripts/generate-tests.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from '@stoplight/path';
22
import * as swc from '@swc/core';
3-
import fg from 'fast-glob';
3+
import { glob } from 'tinyglobby';
44
import * as fileEntryCache from 'file-entry-cache';
55
import * as _fs from 'fs';
66

@@ -50,9 +50,12 @@ function getChangedScenarios(changedFiles: string[], scenarios: string[]): strin
5050
(async () => {
5151
await fs.mkdir(OUT_DIR, { recursive: true });
5252

53-
const scenarios = await fg('**/*.scenario', { cwd: SCENARIOS_DIR, absolute: true });
53+
const scenarios = await glob('**/*.scenario', { cwd: SCENARIOS_DIR, absolute: true, expandDirectories: false });
5454
const cache = fileEntryCache.create('spectral-test-harness', path.join(__dirname, '../../.cache'), true);
55-
const changedFiles = cache.getUpdatedFiles([...scenarios, ...(await fg('**/**', { cwd: OUT_DIR, absolute: true }))]);
55+
const changedFiles = cache.getUpdatedFiles([
56+
...scenarios,
57+
...(await glob('**/**', { cwd: OUT_DIR, absolute: true, expandDirectories: false }))
58+
]);
5659
const changedScenarios = getChangedScenarios(changedFiles, scenarios);
5760

5861
await Promise.all(

yarn.lock

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,12 +2948,12 @@ __metadata:
29482948
"@yao-pkg/pkg": 5.11.0
29492949
chalk: 4.1.2
29502950
es-aggregate-error: ^1.0.7
2951-
fast-glob: ~3.2.12
29522951
hpagent: ~1.2.0
29532952
lodash: ~4.17.21
29542953
nock: ^13.5.4
29552954
pony-cause: ^1.1.1
29562955
stacktracey: ^2.1.8
2956+
tinyglobby: ^0.2.14
29572957
tslib: ^2.8.1
29582958
xml2js: ^0.5.0
29592959
yargs: ~17.7.2
@@ -6896,32 +6896,6 @@ __metadata:
68966896
languageName: node
68976897
linkType: hard
68986898

6899-
"fast-glob@npm:^3.3.3":
6900-
version: 3.3.3
6901-
resolution: "fast-glob@npm:3.3.3"
6902-
dependencies:
6903-
"@nodelib/fs.stat": ^2.0.2
6904-
"@nodelib/fs.walk": ^1.2.3
6905-
glob-parent: ^5.1.2
6906-
merge2: ^1.3.0
6907-
micromatch: ^4.0.8
6908-
checksum: 0704d7b85c0305fd2cef37777337dfa26230fdd072dce9fb5c82a4b03156f3ffb8ed3e636033e65d45d2a5805a4e475825369a27404c0307f2db0c8eb3366fbd
6909-
languageName: node
6910-
linkType: hard
6911-
6912-
"fast-glob@npm:~3.2.12":
6913-
version: 3.2.12
6914-
resolution: "fast-glob@npm:3.2.12"
6915-
dependencies:
6916-
"@nodelib/fs.stat": ^2.0.2
6917-
"@nodelib/fs.walk": ^1.2.3
6918-
glob-parent: ^5.1.2
6919-
merge2: ^1.3.0
6920-
micromatch: ^4.0.4
6921-
checksum: 0b1990f6ce831c7e28c4d505edcdaad8e27e88ab9fa65eedadb730438cfc7cde4910d6c975d6b7b8dc8a73da4773702ebcfcd6e3518e73938bb1383badfe01c2
6922-
languageName: node
6923-
linkType: hard
6924-
69256899
"fast-json-stable-stringify@npm:2.x, fast-json-stable-stringify@npm:^2.0.0":
69266900
version: 2.0.0
69276901
resolution: "fast-json-stable-stringify@npm:2.0.0"
@@ -6982,6 +6956,18 @@ __metadata:
69826956
languageName: node
69836957
linkType: hard
69846958

6959+
"fdir@npm:^6.4.4":
6960+
version: 6.4.6
6961+
resolution: "fdir@npm:6.4.6"
6962+
peerDependencies:
6963+
picomatch: ^3 || ^4
6964+
peerDependenciesMeta:
6965+
picomatch:
6966+
optional: true
6967+
checksum: fe9f3014901d023cf631831dcb9eae5447f4d7f69218001dd01ecf007eccc40f6c129a04411b5cc273a5f93c14e02e971e17270afc9022041c80be924091eb6f
6968+
languageName: node
6969+
linkType: hard
6970+
69856971
"fetch-mock@npm:^9.11.0":
69866972
version: 9.11.0
69876973
resolution: "fetch-mock@npm:9.11.0"
@@ -10066,7 +10052,7 @@ __metadata:
1006610052
languageName: node
1006710053
linkType: hard
1006810054

10069-
"micromatch@npm:^4.0.0, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.8":
10055+
"micromatch@npm:^4.0.0, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4":
1007010056
version: 4.0.8
1007110057
resolution: "micromatch@npm:4.0.8"
1007210058
dependencies:
@@ -11466,6 +11452,13 @@ __metadata:
1146611452
languageName: node
1146711453
linkType: hard
1146811454

11455+
"picomatch@npm:^4.0.2":
11456+
version: 4.0.2
11457+
resolution: "picomatch@npm:4.0.2"
11458+
checksum: a7a5188c954f82c6585720e9143297ccd0e35ad8072231608086ca950bee672d51b0ef676254af0788205e59bd4e4deb4e7708769226bed725bf13370a7d1464
11459+
languageName: node
11460+
linkType: hard
11461+
1146911462
"pify@npm:^3.0.0":
1147011463
version: 3.0.0
1147111464
resolution: "pify@npm:3.0.0"
@@ -12297,7 +12290,6 @@ __metadata:
1229712290
eslint-plugin-import: ^2.26.0
1229812291
eslint-plugin-prettier: ^4.2.1
1229912292
expect: ^27.5.1
12300-
fast-glob: ^3.3.3
1230112293
fetch-mock: ^9.11.0
1230212294
file-entry-cache: ^6.0.1
1230312295
husky: ^7.0.4
@@ -12315,6 +12307,7 @@ __metadata:
1231512307
patch-package: ^6.4.7
1231612308
prettier: ^2.4.1
1231712309
semantic-release: ^19.0.5
12310+
tinyglobby: ^0.2.14
1231812311
ts-jest: ^29.2.5
1231912312
ts-node: ^10.8.2
1232012313
typescript: 4.4.4
@@ -13358,6 +13351,16 @@ __metadata:
1335813351
languageName: node
1335913352
linkType: hard
1336013353

13354+
"tinyglobby@npm:^0.2.14":
13355+
version: 0.2.14
13356+
resolution: "tinyglobby@npm:0.2.14"
13357+
dependencies:
13358+
fdir: ^6.4.4
13359+
picomatch: ^4.0.2
13360+
checksum: 261e986e3f2062dec3a582303bad2ce31b4634b9348648b46828c000d464b012cf474e38f503312367d4117c3f2f18611992738fca684040758bba44c24de522
13361+
languageName: node
13362+
linkType: hard
13363+
1336113364
"tmp@npm:^0.0.33":
1336213365
version: 0.0.33
1336313366
resolution: "tmp@npm:0.0.33"

0 commit comments

Comments
 (0)