refactor(javascript): share Babel child traversal

This commit is contained in:
morluto
2026-10-10 05:13:53 +08:00
parent 617cd84d27
commit 0f10499245
3 changed files with 13 additions and 46 deletions
@@ -50,7 +50,8 @@ interface TraversalFrame {
nextIndex: number;
}
const childNodes = (node: t.Node): t.Node[] => {
/** Return child Babel nodes in visitor-key order. */
export const childNodes = (node: t.Node): t.Node[] => {
const keys = t.VISITOR_KEYS[node.type];
if (keys === undefined) return [];
const children: t.Node[] = [];