Skip to content

Commit 6fb5105

Browse files
committed
chore(deps): switch to tinyglobby
1 parent 27b5f00 commit 6fb5105

File tree

12 files changed

+51
-35
lines changed

12 files changed

+51
-35
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"eslint-plugin-n": "17.17.0",
7474
"eslint-plugin-promise": "7.2.1",
7575
"eslint-plugin-standard": "5.0.0",
76-
"globby": "11.1.0",
7776
"graphql": "16.11.0",
7877
"graphql-yoga": "5.13.4",
7978
"husky": "9.1.7",
@@ -82,6 +81,7 @@
8281
"patch-package": "8.0.0",
8382
"prettier": "3.5.3",
8483
"prettier-plugin-tailwindcss": "0.6.11",
84+
"tinyglobby": "0.2.13",
8585
"ts-jest": "29.3.2",
8686
"tsx": "4.19.4",
8787
"typedoc": "0.25.13",

packages/load-files/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
5252
},
5353
"dependencies": {
54-
"globby": "11.1.0",
54+
"tinyglobby": "^0.2.13",
5555
"tslib": "^2.4.0",
5656
"unixify": "^1.0.0"
5757
},

packages/load-files/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { promises as fsPromises, readFileSync, statSync } from 'fs';
22
import { createRequire } from 'module';
33
import { extname, join } from 'path';
44
import { cwd } from 'process';
5-
import globby, { GlobbyOptions, sync as globbySync } from 'globby';
65
import { DocumentNode, parse } from 'graphql';
6+
import { GlobOptions, globSync, glob as tinyglobby } from 'tinyglobby';
77
import unixify from 'unixify';
88

99
const { readFile, stat } = fsPromises;
@@ -63,8 +63,8 @@ async function isDirectory(path: string) {
6363
}
6464
}
6565

66-
function scanForFilesSync(globStr: string | string[], globOptions: GlobbyOptions = {}): string[] {
67-
return globbySync(globStr, { absolute: true, ...globOptions });
66+
function scanForFilesSync(globStr: string | string[], globOptions: GlobOptions = {}): string[] {
67+
return globSync(globStr, { absolute: true, ...globOptions });
6868
}
6969

7070
function formatExtension(extension: string): string {
@@ -98,8 +98,8 @@ export interface LoadFilesOptions {
9898
useRequire?: boolean;
9999
// An alternative to `require` to use if `require` would be used to load a file
100100
requireMethod?: any;
101-
// Additional options to pass to globby
102-
globOptions?: GlobbyOptions;
101+
// Additional options to pass to tinyglobby
102+
globOptions?: GlobOptions;
103103
// Named exports to extract from each file. Defaults to ['typeDefs', 'schema']
104104
exportNames?: string[];
105105
// Load files from nested directories. Set to `false` to only search the top-level directory.
@@ -183,9 +183,9 @@ export function loadFilesSync<T = any>(
183183

184184
async function scanForFiles(
185185
globStr: string | string[],
186-
globOptions: GlobbyOptions = {},
186+
globOptions: GlobOptions = {},
187187
): Promise<string[]> {
188-
return globby(globStr, { absolute: true, ...globOptions });
188+
return tinyglobby(globStr, { absolute: true, ...globOptions });
189189
}
190190

191191
const checkExtension = (

packages/load/tests/loaders/documents/documents-from-glob.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { loadDocuments, loadDocumentsSync, NoTypeDefinitionsFound } from '@graph
66
import { runTests } from '../../../../testing/utils.js';
77
import '../../../../testing/to-be-similar-string';
88
import { readFileSync } from 'fs';
9-
import globby from 'globby';
9+
import { globSync } from 'tinyglobby';
1010
import { removeLoc } from '@graphql-tools/optimize';
1111

1212
describe('documentsFromGlob', () => {
@@ -20,7 +20,7 @@ describe('documentsFromGlob', () => {
2020
loaders: [new GraphQLFileLoader()],
2121
});
2222
expect(result).toHaveLength(1);
23-
const expectedFiles = globby.sync(glob);
23+
const expectedFiles = globSync(glob);
2424
for (const expectedFileName of expectedFiles) {
2525
const fileNameResult = result?.find(({ location }) => location === expectedFileName);
2626
if (fileNameResult) {
@@ -38,7 +38,7 @@ describe('documentsFromGlob', () => {
3838
loaders: [new GraphQLFileLoader()],
3939
});
4040
expect(result).toHaveLength(2);
41-
const expectedFiles = globby.sync(glob);
41+
const expectedFiles = globSync(glob);
4242
for (const expectedFileName of expectedFiles) {
4343
const fileNameResult = result?.find(({ location }) => location === expectedFileName);
4444
if (fileNameResult) {

packages/loaders/code-file/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"dependencies": {
5454
"@graphql-tools/graphql-tag-pluck": "8.3.19",
5555
"@graphql-tools/utils": "^10.8.6",
56-
"globby": "^11.0.3",
56+
"tinyglobby": "^0.2.13",
5757
"tslib": "^2.4.0",
5858
"unixify": "^1.0.0"
5959
},

packages/loaders/code-file/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { existsSync, promises as fsPromises, readFileSync } from 'fs';
22
import { createRequire } from 'module';
33
import { isAbsolute, resolve } from 'path';
44
import { cwd, env } from 'process';
5-
import type { GlobbyOptions } from 'globby';
6-
import globby from 'globby';
75
import { DocumentNode, GraphQLSchema, isSchema, parse } from 'graphql';
6+
import type { GlobOptions } from 'tinyglobby';
7+
import { globSync, glob as tinyglobby } from 'tinyglobby';
88
import unixify from 'unixify';
99
import {
1010
gqlPluckFromCodeString,
@@ -59,7 +59,7 @@ const FILE_EXTENSIONS = [
5959
'.gjs',
6060
];
6161

62-
function createGlobbyOptions(options: CodeFileLoaderOptions): GlobbyOptions {
62+
function createGlobbyOptions(options: CodeFileLoaderOptions): GlobOptions {
6363
return { absolute: true, ...options, ignore: [] };
6464
}
6565

@@ -138,13 +138,13 @@ export class CodeFileLoader implements Loader<CodeFileLoaderOptions> {
138138
async resolveGlobs(glob: string, options: CodeFileLoaderOptions) {
139139
options = this.getMergedOptions(options);
140140
const globs = this._buildGlobs(glob, options);
141-
return globby(globs, createGlobbyOptions(options));
141+
return tinyglobby(globs, createGlobbyOptions(options));
142142
}
143143

144144
resolveGlobsSync(glob: string, options: CodeFileLoaderOptions) {
145145
options = this.getMergedOptions(options);
146146
const globs = this._buildGlobs(glob, options);
147-
return globby.sync(globs, createGlobbyOptions(options));
147+
return globSync(globs, createGlobbyOptions(options));
148148
}
149149

150150
async load(pointer: string, options: CodeFileLoaderOptions): Promise<Source[]> {

packages/loaders/graphql-file/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"dependencies": {
5454
"@graphql-tools/import": "7.0.18",
5555
"@graphql-tools/utils": "^10.8.6",
56-
"globby": "^11.0.3",
56+
"tinyglobby": "^0.2.13",
5757
"tslib": "^2.4.0",
5858
"unixify": "^1.0.0"
5959
},

packages/loaders/graphql-file/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { existsSync, promises as fsPromises, readFileSync } from 'fs';
22
import { isAbsolute, resolve } from 'path';
33
import { env, cwd as processCwd } from 'process';
4-
import type { GlobbyOptions } from 'globby';
5-
import globby from 'globby';
4+
import type { GlobOptions } from 'tinyglobby';
5+
import { globSync, glob as tinyglobby } from 'tinyglobby';
66
import unixify from 'unixify';
77
import { processImport } from '@graphql-tools/import';
88
import {
@@ -41,7 +41,7 @@ function isGraphQLImportFile(rawSDL: string) {
4141
return trimmedRawSDL.startsWith('# import') || trimmedRawSDL.startsWith('#import');
4242
}
4343

44-
function createGlobbyOptions(options: GraphQLFileLoaderOptions): GlobbyOptions {
44+
function createGlobbyOptions(options: GraphQLFileLoaderOptions): GlobOptions {
4545
return { absolute: true, ...options, ignore: [] };
4646
}
4747

@@ -119,7 +119,7 @@ export class GraphQLFileLoader implements Loader<GraphQLFileLoaderOptions> {
119119
)
120120
return [glob]; // bypass globby when no glob character, can be loaded, no ignores and source not requested. Fixes problem with pkg and passes ci tests
121121
const globs = this._buildGlobs(glob, options);
122-
const result = await globby(globs, createGlobbyOptions(options));
122+
const result = await tinyglobby(globs, createGlobbyOptions(options));
123123
return result;
124124
}
125125

@@ -132,7 +132,7 @@ export class GraphQLFileLoader implements Loader<GraphQLFileLoaderOptions> {
132132
)
133133
return [glob]; // bypass globby when no glob character, can be loaded, no ignores and source not requested. Fixes problem with pkg and passes ci tests
134134
const globs = this._buildGlobs(glob, options);
135-
const result = globby.sync(globs, createGlobbyOptions(options));
135+
const result = globSync(globs, createGlobbyOptions(options));
136136
return result;
137137
}
138138

packages/loaders/json-file/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
},
5353
"dependencies": {
5454
"@graphql-tools/utils": "^10.8.6",
55-
"globby": "^11.0.3",
55+
"tinyglobby": "^0.2.13",
5656
"tslib": "^2.4.0",
5757
"unixify": "^1.0.0"
5858
},

packages/loaders/json-file/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { existsSync, promises as fsPromises, readFileSync } from 'fs';
22
import { isAbsolute, resolve } from 'path';
33
import { env, cwd as processCwd } from 'process';
4-
import type { GlobbyOptions } from 'globby';
5-
import globby from 'globby';
4+
import type { GlobOptions } from 'tinyglobby';
5+
import { globSync, glob as tinyglobby } from 'tinyglobby';
66
import unixify from 'unixify';
77
import {
88
asArray,
@@ -22,7 +22,7 @@ const FILE_EXTENSIONS = ['.json'];
2222
*/
2323
export interface JsonFileLoaderOptions extends BaseLoaderOptions {}
2424

25-
function createGlobbyOptions(options: JsonFileLoaderOptions): GlobbyOptions {
25+
function createGlobbyOptions(options: JsonFileLoaderOptions): GlobOptions {
2626
return { absolute: true, ...options, ignore: [] };
2727
}
2828

@@ -90,13 +90,13 @@ export class JsonFileLoader implements Loader {
9090

9191
async resolveGlobs(glob: string, options: JsonFileLoaderOptions) {
9292
const globs = this._buildGlobs(glob, options);
93-
const result = await globby(globs, createGlobbyOptions(options));
93+
const result = await tinyglobby(globs, createGlobbyOptions(options));
9494
return result;
9595
}
9696

9797
resolveGlobsSync(glob: string, options: JsonFileLoaderOptions) {
9898
const globs = this._buildGlobs(glob, options);
99-
const result = globby.sync(globs, createGlobbyOptions(options));
99+
const result = globSync(globs, createGlobbyOptions(options));
100100
return result;
101101
}
102102

0 commit comments

Comments
 (0)