Skip to content

Commit 8cd4aa0

Browse files
byCedricfacebook-github-bot
authored andcommitted
Upgrade glob@7 to glob@10 to resolve deprecation warnings
Summary: This is a long overdue follow-up from facebook/react-native#46724, and upgrades the deprecated `glob@7` to `glob@10`. When creating any React Native project today, you are greeted by a wall of deprecation warnings when installing with `npm` -- with the most frequent offender being `[email protected]`. This hurts UX and diminishes developers' trust, even before starting their project. <img width="1005" alt="image" src="https://github.com/user-attachments/assets/a5661470-98df-4f3f-8be2-7b0baa9711b6" /> Unfortunately, no [flow types are available for `glob@9+`](https://github.com/flow-typed/flow-typed/tree/main/definitions/npm). I've tried creating a flow definition, but it turns out that the `glob@10` types use `path-scurry@^1.11.1`, `minimatch@^9.0.4`, and `minipass@^7.1.2` -- all without flow type definitions. Writing the flow definitions for glob@9+ is non-trivial work, I'd be happy to help but I can't fix that on my own. > [!IMPORTANT] > `glob@11` has already been released, but it's only supporting Node 20+. I believe React Native still supports Node 18 until the EOL in April 2025, that's why I used `glob@10`. ## Changelog: [GENERAL] [CHANGED] - Upgrade from deprecated `glob@7` to supported `glob@10` <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [GENERAL] [CHANGED] - Upgrade from deprecated `glob@7` to supported `glob@10` For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests X-link: facebook/react-native#48875 Reviewed By: robhogan, cortinico Differential Revision: D69594539 Pulled By: huntie
1 parent 14d7235 commit 8cd4aa0

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

flow-typed/npm/glob_v7.x.x.js

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// flow-typed signature: d2a519d7d007e9ba3e5bf2ac3ff76eca
2+
// flow-typed version: f243e51ed7/glob_v7.x.x/flow_>=v0.104.x
3+
4+
declare module "glob" {
5+
declare type MinimatchOptions = {|
6+
debug?: boolean,
7+
nobrace?: boolean,
8+
noglobstar?: boolean,
9+
dot?: boolean,
10+
noext?: boolean,
11+
nocase?: boolean,
12+
nonull?: boolean,
13+
matchBase?: boolean,
14+
nocomment?: boolean,
15+
nonegate?: boolean,
16+
flipNegate?: boolean
17+
|};
18+
19+
declare type Options = {|
20+
...MinimatchOptions,
21+
cwd?: string,
22+
root?: string,
23+
nomount?: boolean,
24+
mark?: boolean,
25+
nosort?: boolean,
26+
stat?: boolean,
27+
silent?: boolean,
28+
strict?: boolean,
29+
cache?: { [path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray<string>, ... },
30+
statCache?: { [path: string]: boolean | { isDirectory(): boolean, ... } | void, ... },
31+
symlinks?: { [path: string]: boolean | void, ... },
32+
realpathCache?: { [path: string]: string, ... },
33+
sync?: boolean,
34+
nounique?: boolean,
35+
nodir?: boolean,
36+
ignore?: string | $ReadOnlyArray<string>,
37+
follow?: boolean,
38+
realpath?: boolean,
39+
absolute?: boolean
40+
|};
41+
42+
/**
43+
* Called when an error occurs, or matches are found
44+
* err
45+
* matches: filenames found matching the pattern
46+
*/
47+
declare type CallBack = (err: ?Error, matches: Array<string>) => void;
48+
49+
declare class Glob extends events$EventEmitter {
50+
constructor(pattern: string): this;
51+
constructor(pattern: string, callback: CallBack): this;
52+
constructor(pattern: string, options: Options, callback: CallBack): this;
53+
54+
minimatch: {...};
55+
options: Options;
56+
aborted: boolean;
57+
cache: { [path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray<string>, ... };
58+
statCache: { [path: string]: boolean | { isDirectory(): boolean, ... } | void, ... };
59+
symlinks: { [path: string]: boolean | void, ... };
60+
realpathCache: { [path: string]: string, ... };
61+
found: Array<string>;
62+
63+
pause(): void;
64+
resume(): void;
65+
abort(): void;
66+
}
67+
68+
declare class GlobModule {
69+
Glob: Class<Glob>;
70+
71+
(pattern: string, callback: CallBack): void;
72+
(pattern: string, options: Options, callback: CallBack): void;
73+
74+
hasMagic(pattern: string, options?: Options): boolean;
75+
sync(pattern: string, options?: Options): Array<string>;
76+
}
77+
78+
declare module.exports: GlobModule;
79+
}

0 commit comments

Comments
 (0)