API reference
AST API
Parse, walk, extract and edit TypeScript and JSX.
12 modules, 88 documented exports. Version v0.8. All packages.
packages/ast
- domainPurityAST package: domain purity allowlist detection, additive alongside the existing DOMAIN-001 denylist in packages/core/architecture-enforcer.mjs. Exports: BUILTIN_GLOBALS, collectImpureDomainReferences, collectLocallyBoundNames
- extractAST package: extraction. Exports: extractExports, extractImports, extractJsdoc, lineOf, staticImportEntries
- importsAST package: inserting a brand-new top-level import statement -- the missing primitive the existing edit ops (jsxEdit.mjs) don't cover: every function there edits an EXISTING JSX node's text; this adds a whole new Imp... Exports: insertNamedImport
- jsxComplexityAST package: JSX shape/complexity detection. Exports: collectInlineJsxLogic, computeJsxComplexity
- jsxEditAST package: deterministic text edits on JSX nodes located by parseJsxTree. Exports: NEW_CHILD_SNIPPET, addChildText, insertStatementBeforeJsx, removeAttributeText, removeNodeText, renderAttrValue, setAttributeText, setSpreadText, ...
- jsxParseAST package: strict JSX parsing on typescript-estree (the JSX edit/analysis family, #173). Exports: checkJsxReplacement, jsxParseError, parseJsx
- jsxScopeAST package: what a page component has in scope, and what a child component declares. Exports: collectComponentScopeNames, collectScopeDeclarations, declaredPropNames, findImportOfName, findTypeMembers
- jsxTreeAST package: the JSX element tree with stable node ids. Exports: findParentRecord, jsxAttributes, jsxNameToString, parseJsxTree
- parseAST package: parsing. Exports: parseToAst, parseTsSource
- tsNodesAST package: TypeScript compiler API helpers -- searching a ts.SourceFile and printing `ts.factory` nodes back to source. Exports: findAllNodes, findNode, printNode
- walkAST package: traversal. Exports: CONTROL_FLOW_TYPES, collectBareIdentifierUsages, collectCalls, collectControlFlowNodes, isNonUsagePosition, walkForUsage