Skip to content

Comments

Add memo names to Babel#365

Merged
bterlson merged 2 commits intoalloy-framework:mainfrom
bterlson:feat/babel-memo-naming
Feb 13, 2026
Merged

Add memo names to Babel#365
bterlson merged 2 commits intoalloy-framework:mainfrom
bterlson:feat/babel-memo-naming

Conversation

@bterlson
Copy link
Contributor

This allows the debugger to show more useful information for memos created by the transform (e.g. for fragments).

…expressions

New describeExpression() function generates names from AST expression nodes
(e.g., 'props.name', 'items.filter(…)', 'condition ? …'). The name is
passed as the third argument to memo() when config.addSourceInfo is enabled.

These names appear in debug traces and devtools, making it easier to identify
which reactive computations are running. Names are truncated at 50 characters.

Changes in both src/ and pre-built index.js to stay in sync.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

All changed packages have been documented.

  • @alloy-js/babel-plugin-jsx-dom-expressions
Show changes

@alloy-js/babel-plugin-jsx-dom-expressions - feature ✏️

Add human-readable expression names to auto-memoized JSX expressions in dev builds to improve debug trace readability.

… case, add memo name tests

- describeExpression: add NumericLiteral check so arr[0] renders as
  'arr[0]' instead of 'arr[…]'
- truncName: use 's != null' instead of 's &&' to correctly handle
  empty string input
- Add memo name parameter tests (3 tests): getter .name is set when
  provided, not set when omitted, value correctness with name
@bterlson bterlson force-pushed the feat/babel-memo-naming branch from 252d771 to 1ca15e5 Compare February 13, 2026 19:47
@bterlson bterlson merged commit 5a3d1a5 into alloy-framework:main Feb 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant