Context
Lykn compiles .lykn source to .js output. Currently there is no
mapping between compiled JS line/column positions and original
lykn source positions. This means:
- Stack traces from compiled code reference JS lines, not lykn
lines.
- IDE debuggers can't set breakpoints in lykn source.
- DD-49 Rule 7's "bridged error-message format"
("isValid (valid?): ...") exists specifically because the
compiled name in stack traces doesn't connect back to the user's
source name. With source maps, the parenthesized form could be
dropped — runtime stack traces would resolve to lykn locations
directly.
What needs to be designed
Generate .js.map files alongside .js files. Standard source-map
v3 format. The compilation pipeline already tracks span
information through SExpr::Span on the Rust side and equivalent
on the JS side — that span data is the input to source-map
generation.
Open design questions:
- Per-file or bundled source maps?
- Include surface forms (post-expansion) or only kernel forms?
- Inline (data: URL) or external file?
- Build-pipeline integration (
lykn build, lykn build --dist)?
Downstream effects when source maps land
- DD-49 Rule 7 bridging format becomes redundant; can be simplified.
- IDE / LSP integration becomes feasible (separate, larger work).
- Debugging UX improves significantly.
Scope
Large. Substantial new infrastructure plus integration across both
compilers. Post-0.6.0 milestone candidate.
References
- DD-49 Rule 7:
docs/design/05-active/0049-identifier-mapping-lykn-js.md
- M7 closing report fast-follow #8
- Phase 2 plan "Out of scope" section: "Multi-file source-mapping
for compiled JS (debugger UX) — Phase 3+"
Context
Lykn compiles
.lyknsource to.jsoutput. Currently there is nomapping between compiled JS line/column positions and original
lykn source positions. This means:
lines.
(
"isValid (valid?): ...") exists specifically because thecompiled name in stack traces doesn't connect back to the user's
source name. With source maps, the parenthesized form could be
dropped — runtime stack traces would resolve to lykn locations
directly.
What needs to be designed
Generate
.js.mapfiles alongside.jsfiles. Standard source-mapv3 format. The compilation pipeline already tracks span
information through
SExpr::Spanon the Rust side and equivalenton the JS side — that span data is the input to source-map
generation.
Open design questions:
lykn build,lykn build --dist)?Downstream effects when source maps land
Scope
Large. Substantial new infrastructure plus integration across both
compilers. Post-0.6.0 milestone candidate.
References
docs/design/05-active/0049-identifier-mapping-lykn-js.mdfor compiled JS (debugger UX) — Phase 3+"