feat: Add new simulator embed build configurations and files, remove#993
feat: Add new simulator embed build configurations and files, remove#993harikrishna-au wants to merge 5 commits intoCircuitVerse:mainfrom
Conversation
…an old embed script, and document GSoC issues for debug panel, session desync, and embed build.
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdds dedicated embed entry points and HTML pages for the simulator (new Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
v1/src/embedMain.ts (1)
14-16: Router history may need to respect the configured base path.The
createWebHistory()is called without a base path argument, butvite.config.tssetsbase: /simulatorvue/${version}/. In production, the router may not correctly resolve routes relative to this base.♻️ Consider passing the base path to createWebHistory
const embedRouter = createRouter({ - history: createWebHistory(), + history: createWebHistory(import.meta.env.BASE_URL), routes: [src/embedMain.ts (2)
14-16: Router history may need to respect the configured base path.Same issue as the v1 version -
createWebHistory()should receive the base URL for correct route resolution in production.♻️ Consider passing the base path to createWebHistory
const embedRouter = createRouter({ - history: createWebHistory(), + history: createWebHistory(import.meta.env.BASE_URL), routes: [
1-37: Consider extracting shared embed bootstrap logic.The
src/embedMain.tsandv1/src/embedMain.tsfiles are identical. While maintaining both v0 and v1 folders is intentional per project conventions, consider whether a shared utility could reduce duplication for the router configuration and app setup.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/embedMain.tssrc/simulator/src/embed.jsv0/embed.htmlv1/embed.htmlv1/src/embedMain.tsvite.config.ts
💤 Files with no reviewable changes (1)
- src/simulator/src/embed.js
…e documentation for embed build, session desync, and debug panel.
…SoC issue documentation for embed build, session desync, and debug panel." This reverts commit b305491.
|
@Nihal4777 review PR |
|
Hey @harikrishna-au if i am not wrong then you are trying to implement Gsoc project 4 "Separate simulator-.js and simulator-embed-.js as separate output files." part right? |
|
If you are trying to create an MVP so that mentors can review it and provide guidance, then please add MVP at the top of the title and feel free to mention them on specific slack channel. Thanks :)) |

feat: separate simulator-embed-{version}.js as a distinct Vite build output
Fixes #990
Describe the changes you have made in this PR
Right now every embed user downloads the full simulator bundle including all the editor tools they can never use. This PR fixes that by adding a separate embed entry point.
What I did:
v0/embed.htmlandv1/embed.htmlas dedicated embed entry pointsv0/src/embedMain.tsandv1/src/embedMain.ts— same asmain.tsbut without bootstrap, tutorials styles, and font preloading since embed view doesn't need themvite.config.tsto build two outputs per version using Rollup's multi-entry input:src/simulator/src/embed.js— it was 132 lines, fully commented out, dead code left over from the jQuery migrationScreenshots of the UI changes (If any)
No visual changes. The embed view looks and works the same, just loaded from a leaner bundle.
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
The idea is straightforward — Rollup supports multiple entry points in a single build. By naming the inputs
simulatorandsimulator-embedand using[name]-${version}.jsas the output template, both files get the right names without touchingmulti-build.js.embedMain.tsis just a trimmed downmain.ts. I removed bootstrap, tutorials styles, and font preloading since none of them are used inembed.vue. The router only has the embed route becauseembed.vuecallsuseRoute()to read the project ID and query params liketheme,clock_time, andfullscreen.The deleted
embed.jswas safe to remove — every single line was commented out.embedListeners.jshandles all the actual embed interaction logic and is untouched.Checklist before requesting a review
Summary by CodeRabbit
New Features
Bug Fixes
Chores