发布 HN:JSX 工具(YC F25) – 一个用于 React 的浏览器开发面板 IDE

5作者: jsunderland3239 天前原帖
嗨,HN,我们是Jamie和Dan,正在开发JSX Tool([https://jsxtool.com](https://jsxtool.com)),这是一款新的检查器/开发面板IDE,允许您通过点击和命令点击轻松导航到React项目的任何JSX行,并探索您的渲染堆栈。 <p>演示视频:[https://www.youtube.com/watch?v=JIIXvN7vhrs](https://www.youtube.com/watch?v=JIIXvN7vhrs)</p> 我已经写了近十年的React代码。自从我第一次在Babel和Redux时代看到源映射以来,我一直希望能够从源映射中编辑我的代码。我也一直想像处理HTML那样检查我的JSX。 <p>去年,我发现我第一次真正使用AI的场景是,在Chrome元素检查器中进行临时的CSS更改,然后将其粘贴到ChatGPT中,询问在Tailwind中的等效写法。接着,我将这些更改粘贴到我的React TSX文件中。</p> 我想简化这个过程,但得出的结论是,为此我需要构建一个JSX检查器。我不得不编写一个自定义AST解析器,以创建JSX与HTML之间的映射。因此,我花了几个月时间开发了一个检查器,使JSX与DOM双向连接。 <p>下一个功能是添加一个CSS编辑器,类似于浏览器检查器中的那个,但用于JSX。与处理HTML的样式不同,我决定对React fiber的任何内存样式编辑都应全局应用,就像您在代码库中调整了那行代码一样。</p> 最终,我能够添加我真正想要的两个AI功能:(1)在我进行像素调整时提示内存样式,以及(2)将这些临时更改保存回我正在使用的代码库中。 <p>为了实现从Chrome扩展与文件系统的交互,我构建了一个小型本地服务器,从您的项目根目录挂载,允许扩展将文件系统命令发送回项目根目录。我们将其命名为“开发服务器”。(注意:您可以在没有安装此服务器的情况下完全使用我们作为JSX检查器。)</p> 经过这一切,我发现要将自己转变为用户,我需要一个功能相对完善的IDE。我需要vim绑定、类型检查器、自动补全、代码检查器、代码搜索和一个合适的文件浏览器。幸运的是,我们能够利用我们偶然发现的开发服务器架构,添加LSP服务器和Rip Grep。经过几个月的使用,我几乎在所有网站编辑中都使用JSX Tool。 <p>我们在移动端仍然有些粗糙,但我们正在努力改进。</p> 所有不涉及AI的IDE功能都是免费的,并且在没有AI的情况下也能正常工作。我们让您免费体验提示功能,但会施加一些使用限制。 <p>扩展本身不是开源的,但带有LSP的开发服务器是开源的。如果您想构建任何类型的浏览器内IDE,这是一个很好的基础,并且几乎与React无关。构建开发服务器是一项重大工程,因此我希望看到有人分叉它并从中找到价值。</p> 未来,我们希望开始添加一些我们能够利用的功能,比如让AI为运行时异常提供代码建议或处理网络日志。我们认为,在开发面板中拥有IDE的便利性使我们在便利性和工作流程上下文中占据了优势。 <p>无论您对AI编码的看法如何,我都希望制作出一个无论有无AI都能有用的工具。我们希望您能试用一下,并愿意分享关于产品技术方面的任何您可能感兴趣的信息。</p>
查看原文
Hi HN, We’re Jamie &amp; Dan, building JSX Tool (<a href="https:&#x2F;&#x2F;jsxtool.com">https:&#x2F;&#x2F;jsxtool.com</a>) a new inspector&#x2F;dev panel IDE that allows you to navigate to any line of your React project’s JSX with just a click and a command click to explore your render stack.<p>Demo video: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JIIXvN7vhrs" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JIIXvN7vhrs</a><p>I’ve been writing React code for nearly a decade. Since I first saw source maps in the days of Babel and Redux, I’ve always wanted to be able to edit my code from the source maps. I’ve also always wanted to be able to inspect my JSX like it was HTML.<p>Last year, I found my first real use of AI was taking ad-hoc CSS changes in the Chrome element inspector, pasting them into ChatGPT, and asking for the equivalent in Tailwind. I’d then paste those changes into my React TSX files.<p>I wanted to streamline this process but came to the conclusion that to do so I needed to build a JSX inspector. I had to write a custom AST parser to create a mapping between the JSX and HTML. So I hacked on an inspector for a couple of months that connected JSX to the DOM in both directions.<p>The next feature was adding a CSS editor, like the one in the browser inspectors but for JSX. Unlike styling a piece of HTML I decided that any in memory style edits to a React fiber should be globally applied, as if you had tweaked that line of code in your codebase.<p>Finally, I was able to add the two AI features I really wanted: (1) prompt for in-memory styles for when I was pixel tweaking, and (2) save those temporary changes back to my codebase in the convention of the codebase I was working in.<p>To accomplish talking to the filesystem from the Chrome extension I built a little local server that mounts from the root of your project and allows the extension to send file-system commands back to your project root. We named this the “Dev Server”. (Note: You can fully use us as a JSX inspector without this server installed.)<p>After all that, I found that to convert myself as a user I needed it to be a pretty fully functional IDE. I needed vim bindings, I needed a typechecker, I needed auto-complete, I needed a linter, I needed code search and I needed a proper file explorer. Fortunately we were able to take advantage of the dev-server architecture we had stumbled onto in order to add an LSP server and Rip Grep. At this point, after months of dog fooding, I use JSX Tool for almost all of my website edits.<p>We’re still rough around the edges for mobile but we’re working on that.<p>All of the IDE stuff not involving AI is free and works fine without AI. We let you get a taste of the prompting stuff for free but apply some rate limits.<p>The extension itself is not open source but the dev server with the LSP is. It’s a great foundation if you want to build any sort of in-browser IDE and it&#x27;s nearly React agnostic. Building the dev server was a big undertaking so I’d love to see someone fork it and find value in it.<p>In the future we want to start adding things that we are in a position to take advantage of over something like Cursor, such as letting AI give you code suggestions for runtime exceptions or work with the network logs. We think that the convenience of having your IDE in the dev panel gives us a leg up in convenience and workflow context.<p>Anyway, regardless of how you feel about AI coding, I wanted to make something that was useful with or without AI. We’d love it if you gave it a spin and we want to share anything we can about the technical side of the product that you might find interesting.