1.0.15 ⢠Published 3 years ago
@mintlify/grove v1.0.15
Grove
Universal AST parser built on Tree-sitter for node
import parser from '@mintlify/grove'
const code = 'print("Hello world")'
const languageId = 'python'
const parsed = parser(code, languageId) // get parsed ASTSee the interactive demo for more information
Installation
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
Installation is done using the
npm install command:
$ npm install @mintlify/groveIn order to use Grove, you have the build from the Rust dependency setup so it properly works for your operating system
$ npm install cargo-cp-artifact --save-dev$ cd ./node_modules/@mintlify/grove/parser && npm run buildWhen deploying to production, make sure to run the above command during the build process
Usage
Import the package
import parser from '@mintlify/grove'Pass in the code and language identifier as strings
const parsed = parser(code, languageId)Currently Grove supports the following languages
| Language | Identifier |
|---|---|
| JavaScript | javascript |
| TypeScript | typescript |
| Python | python |
| PHP | php |
| React JSX | javascriptreact |
| React TSX | typescriptreact |
| Ruby | ruby |
| Rust | rust |
| Java | java |
| Kotlin | kotlin |
| C | c |
| C++ | cpp |
| C# | csharp |
| Dart | dart |
| Go | go |
š§ More languages are under construction and grows in accordance with Tree-sitter's available parsers
More Information
Built with š by the Mintlify team