fix(website): Strip multiline imports in playground transformCode#4031
Conversation
Prettier-wrapped import { … } from blocks were only partially removed,
leaving orphan } from '…' syntax that broke GraphQL live previews.
Also include Playground tests in the ReactDOM Jest project.
Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 95aef71. Configure here.
Require whitespace or a from-clause before the module string so import './setup' is stripped like other static imports. Co-authored-by: Cursor <cursoragent@cursor.com>
CircleCI attach_workspace omits website/, so a hard-coded Jest root failed validation. Only add the Playground root when present, and persist that path so ReactDOM CI still runs transformCode/codeModel. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4031 +/- ##
==========================================
- Coverage 98.21% 97.84% -0.38%
==========================================
Files 154 156 +2
Lines 3024 3057 +33
Branches 601 612 +11
==========================================
+ Hits 2970 2991 +21
- Misses 11 18 +7
- Partials 43 48 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

Summary
transformCodeto remove complete static imports (including Prettier multiline /import type) and export-list/re-export declarations before strippingexportprefixes} from '@data-client/graphql'website/src/components/Playgroundinto the ReactDOM Jest roots so these regressions are covered in CITest plan
yarn test --selectProjects ReactDOM --testPathPatterns 'transformCode|codeModel'Note
Low Risk
Scoped to website playground string preprocessing and CI/Jest wiring; no auth, data, or package runtime changes.
Overview
Fixes GraphQL (and other) homepage playground previews that SyntaxError’d when Prettier-style multiline imports were only partially stripped, leaving orphan
} from '…'fragments.transformCodeno longer uses a single-line regex onimport/export. It now removes full static import declarations (including multiline andimport type), export lists/re-exports, then strips remainingexportprefixes—while preserving bodies like GraphQL resource classes andimport.meta.CI: CircleCI persists
website/src/components/Playgroundinto the workspace; Jest’s ReactDOM project adds that root only when the folder exists, and newtransformCodeunit tests lock in the behavior.Reviewed by Cursor Bugbot for commit 05737e0. Bugbot is set up for automated code reviews on this repo. Configure here.