Skip to content

chore(remix): replace glob with native recursive fs walk#19531

Open
roli-lpci wants to merge 1 commit intogetsentry:developfrom
roli-lpci:chore/remix-replace-glob-with-native-fs
Open

chore(remix): replace glob with native recursive fs walk#19531
roli-lpci wants to merge 1 commit intogetsentry:developfrom
roli-lpci:chore/remix-replace-glob-with-native-fs

Conversation

@roli-lpci
Copy link

Replaces the glob dependency in @sentry/remix with a simple recursive fs.readdirSync walk for finding .map files to delete after source map upload.

  • If you've added code that should be tested, please add tests.
  • 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

Replaces the glob dependency with a simple recursive fs.readdirSync walk for
finding .map files to delete after upload. Uses manual recursion instead of
fs.readdirSync({recursive}) to avoid the Node 18.17-18.18 withFileTypes bug.

Removes glob and its transitive dependencies (minimatch, brace-expansion,
balanced-match, minipass, jackspeak, path-scurry, foreground-child).

Also removes orphaned glob-related resolution overrides from the integration
test package.json.

Ref: getsentry#19447

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant