Skip to content

Rework PR #199: React 19/Turbopack support#204

Open
infi-pc wants to merge 5 commits intov2from
infi-pc/react19-support
Open

Rework PR #199: React 19/Turbopack support#204
infi-pc wants to merge 5 commits intov2from
infi-pc/react19-support

Conversation

@infi-pc
Copy link
Owner

@infi-pc infi-pc commented Mar 6, 2026

Summary

Merged and reworked PR #199 from Feahter's fork adding React 19/Next.js 15+/Turbopack source resolution support. Major cleanup: translated all Chinese strings to English, fixed unconditional preventDefault, resolved type conflicts, and added comprehensive test coverage for new resolution strategies.

Changes

  • Translation: All Chinese comments/strings (100+) across 14+ files translated to English for consistency
  • React 19 Support: Added async source resolution methods (rendererInterfaces API, _debugInfo, _debugStack, Turbopack chunk parsing, source-map reverse lookup)
  • Bug Fix: Fixed unconditional preventDefault/stopPropagation in clickListener with two-phase approach
  • Build Fix: Fixed react-devtools-hook build by adding noEmit: false to tsconfig
  • Type Fix: Removed duplicate ReactDevtoolsHook global declaration
  • Tests: Added 33 new tests covering VLQ decoding, mappings parsing, fileUrlToPath, buildLink Turbopack resolution, and debug mode
  • Exports: Exposed internal functions for testing (decodeVLQ, parseMappings, fileUrlToPath, MappingSegment)

Verification

✅ All 44 tests pass (33 new + 11 existing)
✅ All packages build clean (shared, runtime, react-devtools-hook, extension)
✅ Zero Chinese characters remaining in codebase

Co-Authored-By: Claude Haiku 4.5 noreply@anthropic.com


Note

Medium Risk
Touches core element-to-source resolution and click-to-navigate flow (now async with multiple fallbacks), which could affect navigation reliability and performance in dev environments; changes are localized to dev tooling/runtime behavior with added tests and debug instrumentation.

Overview
Improves LocatorJS navigation for React 19 / Next.js (Turbopack) by adding an async fallback path when sync Fiber source metadata is missing, including a new React click resolver that can use DevTools rendererInterfaces, _debugInfo/_debugStack, source-map reverse lookup, and Turbopack chunk jsxDEV parsing.

Adds Debug Mode (UI toggle + window.__LOCATORJS_DEBUG__) with console tracing/history and a window.locatorDiagnose() helper; wires debug state through persisted options, and updates the runtime click handler to only preventDefault immediately when a link is found (or before awaiting async resolution).

Also updates link building to resolve Turbopack [project]/ paths, hardens WeakMap ID helpers against non-object keys, adjusts shared React DevTools types for React 19, adds a new apps/next-16-turbopack repro app, expands tests around source-map parsing/debug/link building, and refreshes extension docs/scripts with a new node-based release packager.

Written by Cursor Bugbot for commit 82f29d2. This will update automatically on new commits. Configure here.

fez and others added 3 commits January 21, 2026 15:06
- Bump version in package.json from 1.3.1 to 1.3.3.
- Add new build scripts for packaging all versions and releasing.
- Introduce debug mode instructions in README.md for better troubleshooting.
- Implement asynchronous element info retrieval in getElementInfo for improved source mapping.
- Enhance error handling in build.js for better build process visibility.
- Add debug logging capabilities to assist in source location issues.
…upport

Merge branch 'dev-feat-supportReact19' from Feahter/locatorjs fork.
Resolve merge conflicts in buildLink.ts and sharedOptionsStore.ts,
combining nvim tmuxSession support with Turbopack [project]/ path
handling and debugMode option.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Translate all Chinese comments and strings to English (14+ files)
- Fix unconditional preventDefault in clickListener (two-phase approach)
- Remove duplicate ReactDevtoolsHook global declaration
- Fix react-devtools-hook build (noEmit: false in tsconfig)
- Add tests for sourceMapResolver (VLQ, mappings, fileUrlToPath)
- Add tests for buildLink Turbopack [project]/ prefix resolution
- Add tests for debug mode toggle and logging
- Export internal functions for testability
- All 44 tests pass, all builds clean

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
locatorjs Error Error Mar 7, 2026 10:27am

}

function logStep(step, message) {
log(`\n[$${step}] ${message}`, "blue");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logStep outputs spurious dollar sign in step label

Low Severity

The logStep function uses `\n[$${step}]` which produces a literal $ before the step number (e.g., [$1] instead of [1]). The extra $ before ${step} is a literal dollar sign in the template string, making step headers display as [$1], [$2], [$3] instead of the intended [1], [2], [3].

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

export function clearComponentSourceCache(): void {
// WeakMap cannot be cleared, would need to create a new one
// In practice, WeakMap automatically garbage-collects unreferenced keys
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused exported functions never called anywhere

Low Severity

clearComponentSourceCache is exported but is a no-op (empty body with a comment that WeakMap can't be cleared). clearTurbopackCache is exported but never called anywhere in the codebase. These are dead code that could mislead consumers into thinking cache invalidation works when it doesn't.

Additional Locations (1)

Fix in Cursor Fix in Web

…umbers

- Options.tsx: Add .catch() to getElementInfoAsync promise chain
- clickSourceResolver.ts: Remove dead clearComponentSourceCache no-op
- clickSourceResolver.ts: Add comments explaining 1500/800 search ranges
- reactAdapter.ts: Remove redundant resolveSourceFromFiber call in diagnose
  (findDebugSourceAsync already calls it internally)
@infi-pc infi-pc changed the base branch from master to v2 March 7, 2026 16:49
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