Commit b4071ef
chore(remix): Replace glob with native recursive fs walk (#19531)
Replaces the `glob` dependency in `@sentry/remix` with a simple
recursive `fs.readdirSync` walk for finding `.map` files to delete after
source map upload.
- [x] If you've added code that should be tested, please add tests.
- [x] Ensure your code lints and the test suite passes (`yarn lint`) &
(`yarn test`).
- [ ] Link an issue if there is one related to your pull request. If no
issue is linked, one will be auto-generated and linked.
Ref #19447
## What this does
Replaces `glob.sync('**/*.map', { cwd: buildPath })` in
`deleteSourcemaps.js` with a manual recursive directory walk using
native `fs.readdirSync`. This removes the `glob` package and its
transitive dependency tree (minimatch, brace-expansion, balanced-match,
minipass, jackspeak, path-scurry, foreground-child) from
`@sentry/remix`.
Also cleans up orphaned `glob`/`jackspeak`/`path-scurry` resolution
overrides in the integration test `package.json`.
## Why manual recursion instead of `fs.readdirSync({recursive: true})`
`fs.readdirSync(dir, { recursive: true, withFileTypes: true })` silently
drops entries on Node 18.17-18.18 due to a known Node.js bug. Since
`@sentry/remix` supports Node >= 18, a manual recursive walk avoids this
edge case entirely.
## Behavioral notes
- The walk returns relative paths from `buildPath`, matching
`glob.sync`'s `{ cwd }` output shape
- Non-existent directories return `[]` gracefully (matching glob
behavior)
- The walk includes dotfiles (glob excludes by default with `dot:
false`), but this has zero practical impact since Remix build output
never produces `.map` dotfiles
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent cac4c46 commit b4071ef
File tree
3 files changed
+38
-6
lines changed- packages/remix
- scripts
- test/integration
3 files changed
+38
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
6 | 42 | | |
7 | 43 | | |
8 | 44 | | |
9 | 45 | | |
10 | 46 | | |
11 | | - | |
| 47 | + | |
12 | 48 | | |
13 | 49 | | |
14 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 42 | | |
46 | 43 | | |
47 | 44 | | |
| |||
0 commit comments