Repository navigation
Description
Problem
A user reports that debugger support could make inline component JavaScript worth reconsidering. Debugging the script emitted to the browser is possible with normal browser tools, but that is different from setting a breakpoint in the original component source and getting useful source locations in stack traces.
The inspected component script path wraps and serves JavaScript without emitting runtime source maps back to authored component code. Existing editor source mappings do not automatically provide browser debugger mappings.
Prior art
- Asset pipeline adjacents: ESM output, minification + postprocess hooks, sourcemaps, dev/prod mode #35, section 3, already records deferred source-map work and the need to validate mapping into Python-hosted strings. This issue tracks the concrete debugging experience and that validation; coordinate shared asset-pipeline changes there.
- Asset compiler pipeline (TS/Sass/esbuild) + static export #10 tracks asset compilation.
packages/py/citry/citry/ext/dependencies/types.py: script wrapping.packages/py/citry/citry/ext/dependencies/scripts.pyandroutes.py: processed script caching and serving.
Proposed work
- Prototype browser debugging of both inline
jsandjs_file, starting with plain JavaScript. Prove breakpoints, stepping, local-variable inspection, and stack locations before settling the source representation. - Provide development source maps through script transformations and wrappers. Compose compiler maps where available; state which transformed languages are supported.
- Compare mapping directly into Python files with exposing virtual JavaScript sources containing the authored body. Verify browser and editor behavior rather than assuming mixed-language breakpoints work.
- Keep script identity and maps consistent across initial-page scripts, dynamically loaded fragments, caching, and hot reload.
- Define development enablement, production source exposure, and fallback when a transform supplies no trustworthy map. Do not produce misleading source locations.
- Document browser DevTools first, then validate a Zed Chrome debug configuration. Investigate Helix's browser adapter compatibility separately and report verified capabilities.
Acceptance criteria
A small reproducible component supports a breakpoint in authored JavaScript, stepping, local-variable inspection, and an exception mapped to the correct source. Exercise inline and file-backed code, fragment loading, and a source edit/reload. Verify the claimed browser/editor combinations and record limitations, including whether breakpoints inside the original .py string are supported.
Use existing browser debuggers and adapters unless the prototype demonstrates a concrete missing capability. A custom Citry debug adapter is not a prerequisite. Server-side Python debugging is outside this issue.
References
Related work
- Helix integration: IDE: add and document Helix integration #118
- Zed integration: IDE: add a first-party Zed integration #119
- Shared JavaScript language service: IDE: provide shared JavaScript language-service support through citry-lsp #116
Activity