ast-grep-tree-sitter-dart
v0.0.5
Published
ast-grep language support for Dart using UserNobody14/tree-sitter-dart for tree-sitter-dart
Downloads
471
Readme
ast-grep napi language for dart
Since Dart has been removed as an officially supported language in ast-grep (see here),
This adds Dart language support for @ast-grep/napi using the tree-sitter-dart library from https://github.com/UserNobody14/tree-sitter-dart.
Supporting Dart for @ast-grep/napi can be useful for codemods for the Dart and Flutter ecosystem.
Installation
In a pnpm project, run:
pnpm install ast-grep-tree-sitter-dart
pnpm install @ast-grep/napi
# install the tree-sitter-cli if no prebuild is available
pnpm install @tree-sitter/cli --save-devUsage
import dart from 'ast-grep-tree-sitter-dart'
import { registerDynamicLanguage, parse } from '@ast-grep/napi'
registerDynamicLanguage({ dart })
const sg = parse('dart', `your code`)
sg.root().kind()