How tofu-xx/setupin works
setupin is a browser-side runtime for writing Vue single-file-component syntax directly in HTML. The user places inline SFC blocks in a page; setupin watches for and collects them, compiles them through sfc2esm, then injects an import map, executable module, and compiled styles into the page. The README also advertises top-level await, SFC CSS features, and Options API support. The graph follows the sampled runtime wiring; those feature details are documented but their compiler internals are not sampled.
Main entry points: main.ts Runtime entry · watchRoot.ts Watch head · awaitClientCode.ts Collect SFC · createDom.ts DOM builder
Components 9
SFC Capture
- Collect SFC
src/awaitClientCode.ts - Watch head
src/utils/watchRoot.ts
Compile & Inject
- Runtime entry
src/main.ts - sfc2esm compiler
- DOM builder
src/utils/createDom.ts
Other components
- Page author
- HTML with SFC
- Browser DOM
- Vue ESM CDN
Connections 9
- Page author → HTML with SFC: writes SFC
- Collect SFC → Watch head: starts observing
- Watch head → HTML with SFC: observes head
- Watch head → Collect SFC: returns collected markup
- Runtime entry → Collect SFC: collects source
- Runtime entry → sfc2esm compiler: compiles SFC
- Runtime entry → DOM builder: builds injected nodes
- DOM builder → Browser DOM: mounts nodes
- Runtime entry → Vue ESM CDN: maps Vue import