Repository navigation
Conversation
3 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/open-stack-frame, which LogBox and RedBox use to open a stack frame in the editor, is served only by@react-native-community/cli-server-api, so the dev server depends on the Community CLI for it. The CLI's copy also opens any path on disk and passes unchecked fields to the editor.This diff moves the route into
@react-native/dev-middleware, mounted whencreateDevMiddlewarereceivesunstable_watchFolders, whichrunDevServerpasses as the Metro server root andwatchFolders. It ports Expo's hardening of its own copy (expo/expo#44039, expo/expo#45863).launchEditortoDevToolLauncher.DefaultToolLauncherimplements it withlaunch-editorand$REACT_EDITOR, matching the CLI.fileand keeplineNumberonly when a positive integer; answer 400 otherwise.watchFoldersopening.Originand pass.Paired with react-native-community/cli#2875, which removes the CLI's copy.
Changelog: [General][Added] - Dev server:
@react-native/dev-middlewareserves/open-stack-frame, restricted to the project watch foldersTest Plan
✅ Covers the launch with the posted file and line, same-origin and cross-origin requests, malformed bodies, containment (
.., a symlink out, a nonexistent file, a watch folder itself), the throttle, launcher rejection, and a response an earlier middleware already sent.RNTester on iPhone 18 Pro (iOS 27.0), with a
throwadded to theRNTesterApprender and$REACT_EDITORset to a wrapper around VS Code'scodethat logs each launch. Tapped the top LogBox frame,RNTesterAppShared.js (95:18):cli-server-apiwith its/open-stack-frameremoved, so core serves the routecode -r -g …/rn-tester/js/RNTesterAppShared.js:95:1cli-server-api21.0.0-alpha.1, which mounts its own route firstWith the local CLI,
curl -X POST /open-stack-framefor a file in the repo answered200with core'sOKbody.Not run: Flow; lint; iOS and Android RedBox.