Add decorator support to Live Debugger instrumentation#448
Draft
watson wants to merge 1 commit into
Draft
Conversation
The transform parsed sources with only the `jsx` and `typescript` Babel plugins, so any file using decorators (Angular, NestJS, TypeORM, MobX, ...) failed to parse and was skipped entirely, leaving its functions uninstrumented. Enable decorator parsing and expose a `decorators` option to pick the grammar, since Babel cannot enable both decorator proposals at once: - `legacy` (default): TypeScript `experimentalDecorators` semantics, including parameter decorators. This covers the overwhelming majority of real-world decorator usage. - `modern`: the TC39 Stage 3 proposal, including `accessor` fields and decorators before `export`. A file written in the non-selected style still fails safe -- it is skipped, never miscompiled. Defaulting to `legacy` adds no measurable parse overhead for codebases without decorators. Add validation and defaulting for the option, thread it through to the parser, and cover both modes with tests. Update the README and regenerate its table of contents.
This was referenced Jul 3, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What and why?
The Live Debugger transform parsed every file with only Babel's
jsxandtypescriptplugins. Any file using decorators — Angular, NestJS, TypeORM, MobX, and similar frameworks — therefore failed to parse and was silently skipped (returned uninstrumented, though never miscompiled). Because decorator-heavy stacks can make up a large share of a codebase, Live Debugger could end up with little to no visibility into them. This enables decorator parsing so those files are instrumented, with an option to select which decorator grammar to accept.How?
Adds a
decoratorsoption ('legacy' | 'modern', default'legacy'), because Babel cannot enable the two decorator proposals in a single parse pass.legacymaps to thedecorators-legacyplugin (TypeScript'sexperimentalDecoratorssemantics, including the parameter decorators used heavily in dependency injection) and is the right default for the vast majority of real-world code;modernmaps todecorators+decoratorAutoAccessors(TC39 Stage 3, includingaccessorfields and decorators beforeexport). A file written in the non-selected style still fails safe — it is skipped, never miscompiled.The option is validated and defaulted in
validate.ts, threaded through the plugin handler intotransformCode, and applied by a newgetParserPluginshelper that builds the Babel plugin list; the parser plugin list is now typed asParserPlugin[]rather thanstring[]. Tests cover validation (default value, both accepted values, rejection of invalid input) and the transform itself (legacy decorators with parameter decorators instrument by default, Stage 3 decorators instrument undermodern, and the two grammars are confirmed mutually exclusive). The README documents the option and its table of contents was regenerated withyarn cli integrity. Defaulting tolegacyadds no measurable parse overhead for decorator-free files, verified by benchmarking parse timings with and without the plugin.