Skip to content

feat: pluggable printer support#10

Merged
NaamuKim merged 2 commits intomainfrom
feature/pluggable-printer
Mar 14, 2026
Merged

feat: pluggable printer support#10
NaamuKim merged 2 commits intomainfrom
feature/pluggable-printer

Conversation

@NaamuKim
Copy link
Copy Markdown
Owner

Closes #5

  • Add optional print?(node: any): string to the Parser interface
  • replaceWith(astNode) now serializes builder-created nodes via the active printer
  • Expose z.print(node) for manual serialization
  • Falls back to internal printer when print is not provided (no breaking change)

@github-actions
Copy link
Copy Markdown
Contributor

jscodeshift API Compatibility

jscodeshift API Compatibility Report

Overall: 63/63 (100.0%)

  • supported: 63, partial: 0, not-supported: 0

Core (11/11)

API Status Note
z(source) ✅ supported
namedTypes (z.Identifier etc) ✅ supported
builders (z.identifier() etc) ✅ supported
match(path, filter) ✅ supported
use(plugin) ✅ supported
withParser(parser) ✅ supported
registerMethods ✅ supported
types ✅ supported
template ✅ supported
filters ✅ supported
mappings ✅ supported

Collection (15/15)

API Status Note
filter(callback) ✅ supported
forEach(callback) ✅ supported
some(callback) ✅ supported
every(callback) ✅ supported
map(callback, type?) ✅ supported
size() ✅ supported
nodes() ✅ supported
paths() ✅ supported
getAST() ✅ supported
toSource(options?) ✅ supported
at(index) ✅ supported
get(...fields) ✅ supported
getTypes() ✅ supported
isOfType(type) ✅ supported
length ✅ supported

Traversal (4/4)

API Status Note
find(type, filter?) ✅ supported
closestScope() ✅ supported
closest(type, filter?) ✅ supported
getVariableDeclarators(nameGetter) ✅ supported

Mutation (4/4)

API Status Note
replaceWith(nodes) ✅ supported
insertBefore(insert) ✅ supported
insertAfter(insert) ✅ supported
remove() ✅ supported

JSX (4/4)

API Status Note
findJSXElements(name?) ✅ supported
findJSXElementsByModuleName(moduleName) ✅ supported
childNodes() ✅ supported
childElements() ✅ supported

VariableDeclarator (2/2)

API Status Note
findVariableDeclarators(name?) ✅ supported
renameTo(newName) ✅ supported

NodePath (23/23)

API Status Note
getValueProperty(name) ✅ supported
get(...names) ✅ supported
each(callback, context?) ✅ supported
map(callback, context?) ✅ supported
filter(callback, context?) ✅ supported
shift() ✅ supported
unshift(...args) ✅ supported
push(...args) ✅ supported
pop() ✅ supported
insertAt(index, ...args) ✅ supported
insertBefore(...args) ✅ supported
insertAfter(...args) ✅ supported
replace(replacement?, ...args) ✅ supported
value ✅ supported
parentPath ✅ supported
name ✅ supported
prune(...args) ✅ supported
needsParens(assumeExpressionContext?) ✅ supported
canBeFirstInStatement() ✅ supported
firstInStatement() ✅ supported
node ✅ supported
parent ✅ supported
scope ✅ supported

@NaamuKim NaamuKim merged commit 44acafa into main Mar 14, 2026
3 checks passed
@github-actions github-actions bot mentioned this pull request Mar 14, 2026
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.

custom parser?

1 participant