@driftlog/tree-sitter-dart
v1.0.4
Published
Dart grammar for tree-sitter
Readme
@driftlog/tree-sitter-dart
Dart grammar for tree-sitter, published with prebuilt N-API binaries.
Based on UserNobody14/tree-sitter-dart.
Platforms
Prebuilt binaries are included for:
| OS | Arch | |----|------| | macOS | arm64 | | Linux | x64, arm64 |
Falls back to compiling from source if no prebuilt is available for your platform.
Install
npm install @driftlog/tree-sitter-dart tree-sitterUsage
const Parser = require('tree-sitter')
const Dart = require('@driftlog/tree-sitter-dart')
const parser = new Parser()
parser.setLanguage(Dart)
const tree = parser.parse(`
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
`)
console.log(tree.rootNode.toString())Requirements
- Node.js >= 18
tree-sitter>= 0.22.0
Development
# Install dependencies
npm install --ignore-scripts
# Build from source
npx node-gyp rebuild
# Run tests
npm test
# Build prebuilt binary
npm run prebuildLicense
ISC
