Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC: support launch editor feature for selected component #20821

Draft
wants to merge 1 commit into
base: master
from

Conversation

@iChenLei
Copy link
Contributor

@iChenLei iChenLei commented Feb 14, 2021

Summary

support launch editor feature

Original Feature Request #20435

launchEditor

When you inspected a react component, you can click the launch editor icon to jump to your editor and navigate to the source code original file position.

supoort set custom launchEditorEndpoint

2021-02-14 20 16 23

Why we need this ? Because different launch editor server middleware use different endpoint.

create-react-app user must use __open-stack-frame-in-editor as endpoint cause these hard code.

https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/launchEditorEndpoint.js#L9-L10

// TODO: we might want to make this injectable to support DEV-time non-root URLs.
module.exports = '/__open-stack-frame-in-editor';

launch-editor-middleware user often use __open-in-editor as endpoint.

https://github.com/yyx990803/launch-editor#middleware

const launchMiddleware = require('launch-editor-middleware')
app.use('/__open-in-editor', launchMiddleware())

2021-02-14 20 39 20
Both middleware have many user around world (and exist many custom middleware actually).

Issues need to fix

  1. Can we get the releative file path from devtools ? Now the source path is absolute(e.g. /Users/iChenLei/Documents/cra/reactapp/src/App.js:24).
  2. If we only can use absolute file path, we need create pr for create-react-app/react-dev-utils to support absolute path.
    https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/launchEditor.js#L287-L290
+ const filePath = path.relative(process.cwd(), fileName)
  1. Please help me make a suitable svg icon for launch editorfeature, Thanks for facebook/react official.
  2. Is there common toast ui component to show message about set custom endpoint success ? I think feedback is necessary.

@bvaughn Sir, I need your code review and advices, thanks.

I must say that it's too hard for me to run the devtools extension build and test script, many network error / script error and other problems, It drives me crazy 😭 .

Test Plan

will add necessary unit test later

@sizebot
Copy link

@sizebot sizebot commented Feb 14, 2021

Comparing: 1a74726...8d86de4

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 122.34 kB 122.34 kB = 39.40 kB 39.40 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 128.92 kB 128.92 kB = 41.46 kB 41.46 kB
facebook-www/ReactDOM-prod.classic.js = 404.69 kB 404.69 kB = 75.17 kB 75.17 kB
facebook-www/ReactDOM-prod.modern.js = 393.04 kB 393.04 kB = 73.27 kB 73.27 kB
facebook-www/ReactDOMForked-prod.classic.js = 404.70 kB 404.70 kB = 75.17 kB 75.17 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 8d86de4

@iChenLei iChenLei force-pushed the iChenLei:support-launch-editor branch from 864dbfb to 3f83e57 Feb 14, 2021
@iChenLei iChenLei force-pushed the iChenLei:support-launch-editor branch from 3f83e57 to 8d86de4 Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants